2
0

sequence.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /*-------------------------------------------------------------------------
  2. *
  3. * sequence.h
  4. * prototypes for sequence.c.
  5. *
  6. * Portions Copyright (c) 1996-2022, PostgreSQL Global Development Group
  7. * Portions Copyright (c) 1994, Regents of the University of California
  8. *
  9. * src/include/commands/sequence.h
  10. *
  11. *-------------------------------------------------------------------------
  12. */
  13. #ifndef SEQUENCE_H
  14. #define SEQUENCE_H
  15. #include "access/xlogreader.h"
  16. #include "catalog/objectaddress.h"
  17. #include "fmgr.h"
  18. #include "lib/stringinfo.h"
  19. #include "nodes/parsenodes.h"
  20. #include "parser/parse_node.h"
  21. #include "storage/relfilenode.h"
  22. typedef struct FormData_pg_sequence_data
  23. {
  24. int64 last_value;
  25. int64 log_cnt;
  26. bool is_called;
  27. } FormData_pg_sequence_data;
  28. typedef FormData_pg_sequence_data *Form_pg_sequence_data;
  29. /*
  30. * Columns of a sequence relation
  31. */
  32. #define SEQ_COL_LASTVAL 1
  33. #define SEQ_COL_LOG 2
  34. #define SEQ_COL_CALLED 3
  35. #define SEQ_COL_FIRSTCOL SEQ_COL_LASTVAL
  36. #define SEQ_COL_LASTCOL SEQ_COL_CALLED
  37. /* XLOG stuff */
  38. #define XLOG_SEQ_LOG 0x00
  39. typedef struct xl_seq_rec
  40. {
  41. RelFileNode node;
  42. /* SEQUENCE TUPLE DATA FOLLOWS AT THE END */
  43. } xl_seq_rec;
  44. extern int64 nextval_internal(Oid relid, bool check_permissions);
  45. extern Datum nextval(PG_FUNCTION_ARGS);
  46. extern List *sequence_options(Oid relid);
  47. extern ObjectAddress DefineSequence(ParseState *pstate, CreateSeqStmt *stmt);
  48. extern ObjectAddress AlterSequence(ParseState *pstate, AlterSeqStmt *stmt);
  49. extern void SequenceChangePersistence(Oid relid, char newrelpersistence);
  50. extern void DeleteSequenceTuple(Oid relid);
  51. extern void ResetSequence(Oid seq_relid);
  52. extern void ResetSequenceCaches(void);
  53. extern void seq_redo(XLogReaderState *rptr);
  54. extern void seq_desc(StringInfo buf, XLogReaderState *rptr);
  55. extern const char *seq_identify(uint8 info);
  56. extern void seq_mask(char *pagedata, BlockNumber blkno);
  57. #endif /* SEQUENCE_H */