OSDN Git Service

pgindent run. Make it all clean.
[pg-rex/syncrep.git] / src / include / commands / sequence.h
1 /*-------------------------------------------------------------------------
2  *
3  * sequence.h
4  *        prototypes for sequence.c.
5  *
6  *
7  *-------------------------------------------------------------------------
8  */
9 #ifndef SEQUENCE_H
10 #define SEQUENCE_H
11
12 #include "nodes/parsenodes.h"
13 #include "access/xlog.h"
14
15 typedef struct FormData_pg_sequence
16 {
17         NameData        sequence_name;
18         int32           last_value;
19         int32           increment_by;
20         int32           max_value;
21         int32           min_value;
22         int32           cache_value;
23         int32           log_cnt;
24         char            is_cycled;
25         char            is_called;
26 } FormData_pg_sequence;
27
28 typedef FormData_pg_sequence *Form_pg_sequence;
29
30 /*
31  * Columns of a sequence relation
32  */
33
34 #define SEQ_COL_NAME                    1
35 #define SEQ_COL_LASTVAL                 2
36 #define SEQ_COL_INCBY                   3
37 #define SEQ_COL_MAXVALUE                4
38 #define SEQ_COL_MINVALUE                5
39 #define SEQ_COL_CACHE                   6
40 #define SEQ_COL_LOG                             7
41 #define SEQ_COL_CYCLE                   8
42 #define SEQ_COL_CALLED                  9
43
44 #define SEQ_COL_FIRSTCOL                SEQ_COL_NAME
45 #define SEQ_COL_LASTCOL                 SEQ_COL_CALLED
46
47 /* XLOG stuff */
48 #define XLOG_SEQ_LOG                    0x00
49
50 typedef struct xl_seq_rec
51 {
52         RelFileNode node;
53         /* SEQUENCE TUPLE DATA FOLLOWS AT THE END */
54 } xl_seq_rec;
55
56 extern Datum nextval(PG_FUNCTION_ARGS);
57 extern Datum currval(PG_FUNCTION_ARGS);
58 extern Datum setval(PG_FUNCTION_ARGS);
59 extern Datum setval_and_iscalled(PG_FUNCTION_ARGS);
60
61 extern void DefineSequence(CreateSeqStmt *stmt);
62 extern void CloseSequences(void);
63
64 extern void seq_redo(XLogRecPtr lsn, XLogRecord *rptr);
65 extern void seq_undo(XLogRecPtr lsn, XLogRecord *rptr);
66 extern void seq_desc(char *buf, uint8 xl_info, char *rec);
67
68 #endif   /* SEQUENCE_H */