Fix xslt_process() to ensure that it inserts a NULL terminator after the
[PostgreSQL.git] / src / include / commands / sequence.h
blob8a2c5065b17e7a811951eb197100bfcfb1b891b4
1 /*-------------------------------------------------------------------------
3 * sequence.h
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
9 * $PostgreSQL$
11 *-------------------------------------------------------------------------
13 #ifndef SEQUENCE_H
14 #define SEQUENCE_H
16 #include "nodes/parsenodes.h"
17 #include "storage/relfilenode.h"
18 #include "access/xlog.h"
19 #include "fmgr.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
32 int64 last_value;
33 int64 start_value;
34 int64 increment_by;
35 int64 max_value;
36 int64 min_value;
37 int64 cache_value;
38 int64 log_cnt;
39 #else
40 int32 last_value;
41 int32 pad1;
42 int32 start_value;
43 int32 pad2;
44 int32 increment_by;
45 int32 pad3;
46 int32 max_value;
47 int32 pad4;
48 int32 min_value;
49 int32 pad5;
50 int32 cache_value;
51 int32 pad6;
52 int32 log_cnt;
53 int32 pad7;
54 #endif
55 bool is_cycled;
56 bool is_called;
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
72 #define SEQ_COL_LOG 8
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
79 /* XLOG stuff */
80 #define XLOG_SEQ_LOG 0x00
82 typedef struct xl_seq_rec
84 RelFileNode node;
85 /* SEQUENCE TUPLE DATA FOLLOWS AT THE END */
86 } xl_seq_rec;
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 */