postgresql/src/include/commands/sequence.h

69 lines
1.5 KiB
C
Raw Normal View History

1997-04-02 05:23:38 +02:00
/*-------------------------------------------------------------------------
*
* sequence.h
* prototypes for sequence.c.
1997-04-02 05:23:38 +02:00
*
*
*-------------------------------------------------------------------------
*/
#ifndef SEQUENCE_H
#define SEQUENCE_H
1997-11-26 02:14:33 +01:00
#include "nodes/parsenodes.h"
#include "access/xlog.h"
typedef struct FormData_pg_sequence
{
NameData sequence_name;
int4 last_value;
int4 increment_by;
int4 max_value;
int4 min_value;
int4 cache_value;
int4 log_cnt;
char is_cycled;
char is_called;
} FormData_pg_sequence;
typedef FormData_pg_sequence *Form_pg_sequence;
1997-11-26 02:14:33 +01:00
/*
* Columns of a sequence relation
1997-04-02 05:23:38 +02:00
*/
#define SEQ_COL_NAME 1
#define SEQ_COL_LASTVAL 2
#define SEQ_COL_INCBY 3
#define SEQ_COL_MAXVALUE 4
#define SEQ_COL_MINVALUE 5
#define SEQ_COL_CACHE 6
#define SEQ_COL_LOG 7
#define SEQ_COL_CYCLE 8
#define SEQ_COL_CALLED 9
1997-04-02 05:23:38 +02:00
#define SEQ_COL_FIRSTCOL SEQ_COL_NAME
#define SEQ_COL_LASTCOL SEQ_COL_CALLED
1997-04-02 05:23:38 +02:00
/* XLOG stuff */
#define XLOG_SEQ_LOG 0x00
typedef struct xl_seq_rec
{
RelFileNode node;
/* SEQUENCE TUPLE DATA FOLLOWS AT THE END */
} xl_seq_rec;
extern Datum nextval(PG_FUNCTION_ARGS);
extern Datum currval(PG_FUNCTION_ARGS);
extern Datum setval(PG_FUNCTION_ARGS);
extern Datum setval_and_iscalled(PG_FUNCTION_ARGS);
extern void DefineSequence(CreateSeqStmt *stmt);
extern void CloseSequences(void);
extern void seq_redo(XLogRecPtr lsn, XLogRecord *rptr);
extern void seq_undo(XLogRecPtr lsn, XLogRecord *rptr);
extern void seq_desc(char *buf, uint8 xl_info, char* rec);
#endif /* SEQUENCE_H */