1 /*-------------------------------------------------------------------------
4 * prototypes for sequence.c.
6 * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
7 * Portions Copyright (c) 1994, Regents of the University of California
11 *-------------------------------------------------------------------------
16 #include "nodes/parsenodes.h"
17 #include "storage/relfilenode.h"
18 #include "access/xlog.h"
23 * On a machine with no 64-bit-int C datatype, sizeof(int64) will not be 8,
24 * but we need this struct type to line up with the way that a sequence
25 * table is defined --- and pg_type will say that int8 is 8 bytes anyway.
26 * So, we need padding. Ugly but necessary.
28 typedef struct FormData_pg_sequence
30 NameData sequence_name
;
31 #ifndef INT64_IS_BUSTED
57 } FormData_pg_sequence
;
59 typedef FormData_pg_sequence
*Form_pg_sequence
;
62 * Columns of a sequence relation
65 #define SEQ_COL_NAME 1
66 #define SEQ_COL_LASTVAL 2
67 #define SEQ_COL_STARTVAL 3
68 #define SEQ_COL_INCBY 4
69 #define SEQ_COL_MAXVALUE 5
70 #define SEQ_COL_MINVALUE 6
71 #define SEQ_COL_CACHE 7
73 #define SEQ_COL_CYCLE 9
74 #define SEQ_COL_CALLED 10
76 #define SEQ_COL_FIRSTCOL SEQ_COL_NAME
77 #define SEQ_COL_LASTCOL SEQ_COL_CALLED
80 #define XLOG_SEQ_LOG 0x00
82 typedef struct xl_seq_rec
85 /* SEQUENCE TUPLE DATA FOLLOWS AT THE END */
88 extern Datum
nextval(PG_FUNCTION_ARGS
);
89 extern Datum
nextval_oid(PG_FUNCTION_ARGS
);
90 extern Datum
currval_oid(PG_FUNCTION_ARGS
);
91 extern Datum
setval_oid(PG_FUNCTION_ARGS
);
92 extern Datum
setval3_oid(PG_FUNCTION_ARGS
);
93 extern Datum
lastval(PG_FUNCTION_ARGS
);
95 extern void DefineSequence(CreateSeqStmt
*stmt
);
96 extern void AlterSequence(AlterSeqStmt
*stmt
);
97 extern void AlterSequenceInternal(Oid relid
, List
*options
);
99 extern void seq_redo(XLogRecPtr lsn
, XLogRecord
*rptr
);
100 extern void seq_desc(StringInfo buf
, uint8 xl_info
, char *rec
);
102 #endif /* SEQUENCE_H */