summaryrefslogtreecommitdiff
path: root/src/include/commands/sequence.h
diff options
context:
space:
mode:
authorTom Lane2008-05-16 23:36:05 +0000
committerTom Lane2008-05-16 23:36:05 +0000
commit10a3471bed7b57fb986a5be8afdee5f0dda419de (patch)
tree32de8db702827c67c5cb85479d9bbff22c7b6e94 /src/include/commands/sequence.h
parent8a2f5d221b0d6e41dc66b7e7389668bd208e3529 (diff)
Add a RESTART (without parameter) option to ALTER SEQUENCE, allowing a
sequence to be reset to its original starting value. This requires adding the original start value to the set of parameters (columns) of a sequence object, which is a user-visible change with potential compatibility implications; it also forces initdb. Also add hopefully-SQL-compatible RESTART/CONTINUE IDENTITY options to TRUNCATE TABLE. RESTART IDENTITY executes ALTER SEQUENCE RESTART for all sequences "owned by" any of the truncated relations. CONTINUE IDENTITY is a no-op option. Zoltan Boszormenyi
Diffstat (limited to 'src/include/commands/sequence.h')
-rw-r--r--src/include/commands/sequence.h31
1 files changed, 18 insertions, 13 deletions
diff --git a/src/include/commands/sequence.h b/src/include/commands/sequence.h
index cf95b6394af..fddf9b9ace7 100644
--- a/src/include/commands/sequence.h
+++ b/src/include/commands/sequence.h
@@ -6,7 +6,7 @@
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/commands/sequence.h,v 1.40 2008/03/27 03:57:34 tgl Exp $
+ * $PostgreSQL: pgsql/src/include/commands/sequence.h,v 1.41 2008/05/16 23:36:05 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -30,6 +30,7 @@ typedef struct FormData_pg_sequence
NameData sequence_name;
#ifndef INT64_IS_BUSTED
int64 last_value;
+ int64 start_value;
int64 increment_by;
int64 max_value;
int64 min_value;
@@ -38,16 +39,18 @@ typedef struct FormData_pg_sequence
#else
int32 last_value;
int32 pad1;
- int32 increment_by;
+ int32 start_value;
int32 pad2;
- int32 max_value;
+ int32 increment_by;
int32 pad3;
- int32 min_value;
+ int32 max_value;
int32 pad4;
- int32 cache_value;
+ int32 min_value;
int32 pad5;
- int32 log_cnt;
+ int32 cache_value;
int32 pad6;
+ int32 log_cnt;
+ int32 pad7;
#endif
bool is_cycled;
bool is_called;
@@ -61,13 +64,14 @@ typedef FormData_pg_sequence *Form_pg_sequence;
#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
+#define SEQ_COL_STARTVAL 3
+#define SEQ_COL_INCBY 4
+#define SEQ_COL_MAXVALUE 5
+#define SEQ_COL_MINVALUE 6
+#define SEQ_COL_CACHE 7
+#define SEQ_COL_LOG 8
+#define SEQ_COL_CYCLE 9
+#define SEQ_COL_CALLED 10
#define SEQ_COL_FIRSTCOL SEQ_COL_NAME
#define SEQ_COL_LASTCOL SEQ_COL_CALLED
@@ -90,6 +94,7 @@ extern Datum lastval(PG_FUNCTION_ARGS);
extern void DefineSequence(CreateSeqStmt *stmt);
extern void AlterSequence(AlterSeqStmt *stmt);
+extern void AlterSequenceInternal(Oid relid, List *options);
extern void seq_redo(XLogRecPtr lsn, XLogRecord *rptr);
extern void seq_desc(StringInfo buf, uint8 xl_info, char *rec);