PostgreSQL Source Code  git master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
sequence.h
Go to the documentation of this file.
1 /*-------------------------------------------------------------------------
2  *
3  * sequence.h
4  * prototypes for sequence.c.
5  *
6  * Portions Copyright (c) 1996-2017, PostgreSQL Global Development Group
7  * Portions Copyright (c) 1994, Regents of the University of California
8  *
9  * src/include/commands/sequence.h
10  *
11  *-------------------------------------------------------------------------
12  */
13 #ifndef SEQUENCE_H
14 #define SEQUENCE_H
15 
16 #include "access/xlogreader.h"
17 #include "catalog/objectaddress.h"
18 #include "fmgr.h"
19 #include "lib/stringinfo.h"
20 #include "nodes/parsenodes.h"
21 #include "parser/parse_node.h"
22 #include "storage/relfilenode.h"
23 
24 
26 {
27  int64 last_value;
28  int64 log_cnt;
29  bool is_called;
31 
33 
34 /*
35  * Columns of a sequence relation
36  */
37 
38 #define SEQ_COL_LASTVAL 1
39 #define SEQ_COL_LOG 2
40 #define SEQ_COL_CALLED 3
41 
42 #define SEQ_COL_FIRSTCOL SEQ_COL_LASTVAL
43 #define SEQ_COL_LASTCOL SEQ_COL_CALLED
44 
45 /* XLOG stuff */
46 #define XLOG_SEQ_LOG 0x00
47 
48 typedef struct xl_seq_rec
49 {
51  /* SEQUENCE TUPLE DATA FOLLOWS AT THE END */
52 } xl_seq_rec;
53 
54 extern int64 nextval_internal(Oid relid, bool check_permissions);
56 extern List *sequence_options(Oid relid);
57 
59 extern ObjectAddress AlterSequence(ParseState *pstate, AlterSeqStmt *stmt);
60 extern void DeleteSequenceTuple(Oid relid);
61 extern void ResetSequence(Oid seq_relid);
62 extern void ResetSequenceCaches(void);
63 
64 extern void seq_redo(XLogReaderState *rptr);
65 extern void seq_desc(StringInfo buf, XLogReaderState *rptr);
66 extern const char *seq_identify(uint8 info);
67 extern void seq_mask(char *pagedata, BlockNumber blkno);
68 
69 #endif /* SEQUENCE_H */
void seq_redo(XLogReaderState *rptr)
Definition: sequence.c:1874
void ResetSequenceCaches(void)
Definition: sequence.c:1927
struct xl_seq_rec xl_seq_rec
static void check_permissions(void)
Definition: logicalfuncs.c:109
unsigned char uint8
Definition: c.h:266
uint32 BlockNumber
Definition: block.h:31
RelFileNode node
Definition: sequence.h:50
unsigned int Oid
Definition: postgres_ext.h:31
static char * buf
Definition: pg_test_fsync.c:66
struct FormData_pg_sequence_data FormData_pg_sequence_data
void seq_mask(char *pagedata, BlockNumber blkno)
Definition: sequence.c:1942
uintptr_t Datum
Definition: postgres.h:372
ObjectAddress DefineSequence(ParseState *pstate, CreateSeqStmt *stmt)
Definition: sequence.c:116
int64 nextval_internal(Oid relid, bool check_permissions)
Definition: sequence.c:569
ObjectAddress AlterSequence(ParseState *pstate, AlterSeqStmt *stmt)
Definition: sequence.c:416
List * sequence_options(Oid relid)
Definition: sequence.c:1752
const char * seq_identify(uint8 info)
Definition: seqdesc.c:34
void ResetSequence(Oid seq_relid)
Definition: sequence.c:269
#define PG_FUNCTION_ARGS
Definition: fmgr.h:158
Definition: pg_list.h:45
void DeleteSequenceTuple(Oid relid)
Definition: sequence.c:516
void seq_desc(StringInfo buf, XLogReaderState *rptr)
Definition: seqdesc.c:21
Datum nextval(PG_FUNCTION_ARGS)
Definition: sequence.c:539
FormData_pg_sequence_data * Form_pg_sequence_data
Definition: sequence.h:32