1
/*-------------------------------------------------------------------------
4
* prototypes for sequence.c.
6
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
7
* Portions Copyright (c) 1994, Regents of the University of California
9
* $PostgreSQL: pgsql/src/include/commands/sequence.h,v 1.30 2004-12-31 22:03:28 pgsql Exp $
11
*-------------------------------------------------------------------------
16
#include "nodes/parsenodes.h"
17
#include "access/xlog.h"
22
* On a machine with no 64-bit-int C datatype, sizeof(int64) will not be 8,
23
* but we need this struct type to line up with the way that a sequence
24
* table is defined --- and pg_type will say that int8 is 8 bytes anyway.
25
* So, we need padding. Ugly but necessary.
27
typedef struct FormData_pg_sequence
29
NameData sequence_name;
30
#ifndef INT64_IS_BUSTED
53
} FormData_pg_sequence;
55
typedef FormData_pg_sequence *Form_pg_sequence;
58
* Columns of a sequence relation
61
#define SEQ_COL_NAME 1
62
#define SEQ_COL_LASTVAL 2
63
#define SEQ_COL_INCBY 3
64
#define SEQ_COL_MAXVALUE 4
65
#define SEQ_COL_MINVALUE 5
66
#define SEQ_COL_CACHE 6
68
#define SEQ_COL_CYCLE 8
69
#define SEQ_COL_CALLED 9
71
#define SEQ_COL_FIRSTCOL SEQ_COL_NAME
72
#define SEQ_COL_LASTCOL SEQ_COL_CALLED
75
#define XLOG_SEQ_LOG 0x00
77
typedef struct xl_seq_rec
80
/* SEQUENCE TUPLE DATA FOLLOWS AT THE END */
83
extern Datum nextval(PG_FUNCTION_ARGS);
84
extern Datum currval(PG_FUNCTION_ARGS);
85
extern Datum setval(PG_FUNCTION_ARGS);
86
extern Datum setval_and_iscalled(PG_FUNCTION_ARGS);
88
extern void DefineSequence(CreateSeqStmt *stmt);
89
extern void AlterSequence(AlterSeqStmt *stmt);
91
extern void seq_redo(XLogRecPtr lsn, XLogRecord *rptr);
92
extern void seq_undo(XLogRecPtr lsn, XLogRecord *rptr);
93
extern void seq_desc(char *buf, uint8 xl_info, char *rec);
95
/* Set the upper and lower bounds of a sequence */
96
#ifndef INT64_IS_BUSTED
97
#ifdef HAVE_LL_CONSTANTS
98
#define SEQ_MAXVALUE ((int64) 0x7FFFFFFFFFFFFFFFLL)
100
#define SEQ_MAXVALUE ((int64) 0x7FFFFFFFFFFFFFFF)
102
#else /* INT64_IS_BUSTED */
103
#define SEQ_MAXVALUE ((int64) 0x7FFFFFFF)
104
#endif /* INT64_IS_BUSTED */
106
#define SEQ_MINVALUE (-SEQ_MAXVALUE)
108
#endif /* SEQUENCE_H */