summaryrefslogtreecommitdiff
path: root/src/include/commands
diff options
context:
space:
mode:
authorBruce Momjian2003-03-20 05:18:15 +0000
committerBruce Momjian2003-03-20 05:18:15 +0000
commit8000fdd4621ef08b633588530d97e5ab83eb166e (patch)
tree3ece18543edd498cc6190d58a92d183c81cc2225 /src/include/commands
parenta00431b8d8e3d7b958783fb62b4dd020ec6ec967 (diff)
> > - Move SEQ_MAXVALUE, SEQ_MINVALUE definitions to sequence.h
> > > > - Add check in pg_dump to see if the value returned is the max /min > > values and replace with NO MAXVALUE, NO MINVALUE. > > > > - Change START and INCREMENT to use START WITH and INCREMENT BY syntax. > > This makes it a touch easier to port to other databases with sequences > > (Oracle). PostgreSQL supports both syntaxes already. > > + char bufm[100], > + bufx[100]; > > This seems to be an arbitary size. Why not set it to the actual maximum > length? > > Also: > > + snprintf(bufm, 100, INT64_FORMAT, SEQ_MINVALUE); > + snprintf(bufx, 100, INT64_FORMAT, SEQ_MAXVALUE); > > sizeof(bufm), sizeof(bufx) is probably the more > maintenance-friendly/standard way to do it. I changed the code to use sizeof - but will wait for a response from Peter before changing the size. It's consistent throughout the sequence code to be 100 for this purpose. Rod Taylor <rbt@rbt.ca>
Diffstat (limited to 'src/include/commands')
-rw-r--r--src/include/commands/sequence.h15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/include/commands/sequence.h b/src/include/commands/sequence.h
index e8bf2bf75e9..d4513de8c2e 100644
--- a/src/include/commands/sequence.h
+++ b/src/include/commands/sequence.h
@@ -6,7 +6,7 @@
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: sequence.h,v 1.21 2002/06/20 20:29:49 momjian Exp $
+ * $Id: sequence.h,v 1.22 2003/03/20 05:18:15 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -89,4 +89,17 @@ 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);
+/* Set the upper and lower bounds of a sequence */
+#ifndef INT64_IS_BUSTED
+#ifdef HAVE_LL_CONSTANTS
+#define SEQ_MAXVALUE ((int64) 0x7FFFFFFFFFFFFFFFLL)
+#else
+#define SEQ_MAXVALUE ((int64) 0x7FFFFFFFFFFFFFFF)
+#endif
+#else /* INT64_IS_BUSTED */
+#define SEQ_MAXVALUE ((int64) 0x7FFFFFFF)
+#endif /* INT64_IS_BUSTED */
+
+#define SEQ_MINVALUE (-SEQ_MAXVALUE)
+
#endif /* SEQUENCE_H */