Index: doc/src/sgml/ref/create_sequence.sgml
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/doc/src/sgml/ref/create_sequence.sgml,v
retrieving revision 1.15
diff -c -r1.15 create_sequence.sgml
*** doc/src/sgml/ref/create_sequence.sgml 2000/12/08 20:06:58 1.15
--- doc/src/sgml/ref/create_sequence.sgml 2001/06/22 23:02:48
***************
*** 23,29 ****
1999-07-20
! CREATE SEQUENCE seqname [ INCREMENT increment ]
[ MINVALUE minvalue ] [ MAXVALUE maxvalue ]
[ START start ] [ CACHE cache ] [ CYCLE ]
--- 23,29 ----
1999-07-20
! CREATE [ TEMPORARY | TEMP ] SEQUENCE seqname [ INCREMENT increment ]
[ MINVALUE minvalue ] [ MAXVALUE maxvalue ]
[ START start ] [ CACHE cache ] [ CYCLE ]
***************
*** 36,41 ****
--- 36,54 ----
Inputs
+
+
+
+ TEMPORARY or TEMP
+
+
+ If specified, the sequence is created only for this session, and is
+ automatically dropped on session exit.
+ Existing permanent sequences with the same name are not visible
+ (in this session) while the temporary sequence exists.
+
+
+
Index: src/backend/commands/sequence.c
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/backend/commands/sequence.c,v
retrieving revision 1.59
diff -c -r1.59 sequence.c
*** src/backend/commands/sequence.c 2001/06/13 21:07:12 1.59
--- src/backend/commands/sequence.c 2001/06/22 23:02:49
***************
*** 161,166 ****
--- 161,167 ----
}
stmt->relname = seq->seqname;
+ stmt->istemp = seq->istemp;
stmt->inhRelnames = NIL;
stmt->constraints = NIL;
Index: src/backend/parser/analyze.c
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/backend/parser/analyze.c,v
retrieving revision 1.189
diff -c -r1.189 analyze.c
*** src/backend/parser/analyze.c 2001/06/04 23:27:23 1.189
--- src/backend/parser/analyze.c 2001/06/22 23:02:51
***************
*** 779,784 ****
--- 779,785 ----
sequence = makeNode(CreateSeqStmt);
sequence->seqname = pstrdup(sname);
+ sequence->istemp = stmt->istemp;
sequence->options = NIL;
elog(NOTICE, "CREATE TABLE will create implicit sequence '%s' for SERIAL column '%s.%s'",
***************
*** 2716,2722 ****
return qry;
}
! /*
* Transform uses of %TYPE in a statement.
*/
static Node *
--- 2717,2723 ----
return qry;
}
! /*
* Transform uses of %TYPE in a statement.
*/
static Node *
Index: src/backend/parser/gram.y
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/backend/parser/gram.y,v
retrieving revision 2.231
diff -c -r2.231 gram.y
*** src/backend/parser/gram.y 2001/06/19 22:39:11 2.231
--- src/backend/parser/gram.y 2001/06/22 23:02:53
***************
*** 1574,1584 ****
*
*****************************************************************************/
! CreateSeqStmt: CREATE SEQUENCE relation_name OptSeqList
{
CreateSeqStmt *n = makeNode(CreateSeqStmt);
! n->seqname = $3;
! n->options = $4;
$$ = (Node *)n;
}
;
--- 1574,1585 ----
*
*****************************************************************************/
! CreateSeqStmt: CREATE OptTemp SEQUENCE relation_name OptSeqList
{
CreateSeqStmt *n = makeNode(CreateSeqStmt);
! n->istemp = $2;
! n->seqname = $4;
! n->options = $5;
$$ = (Node *)n;
}
;
Index: src/include/nodes/parsenodes.h
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/include/nodes/parsenodes.h,v
retrieving revision 1.132
diff -c -r1.132 parsenodes.h
*** src/include/nodes/parsenodes.h 2001/06/19 22:39:12 1.132
--- src/include/nodes/parsenodes.h 2001/06/22 23:02:55
***************
*** 402,407 ****
--- 402,408 ----
{
NodeTag type;
char *seqname; /* the relation to create */
+ bool istemp; /* is this a temp sequence? */
List *options;
} CreateSeqStmt;
Index: src/interfaces/ecpg/preproc/preproc.y
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/interfaces/ecpg/preproc/preproc.y,v
retrieving revision 1.140
diff -c -r1.140 preproc.y
*** src/interfaces/ecpg/preproc/preproc.y 2001/06/13 12:38:58 1.140
--- src/interfaces/ecpg/preproc/preproc.y 2001/06/22 23:02:58
***************
*** 1289,1297 ****
*
*****************************************************************************/
! CreateSeqStmt: CREATE SEQUENCE relation_name OptSeqList
{
! $$ = cat_str(3, make_str("create sequence"), $3, $4);
}
;
--- 1289,1297 ----
*
*****************************************************************************/
! CreateSeqStmt: CREATE OptTemp SEQUENCE relation_name OptSeqList
{
! $$ = cat_str(4, make_str("create sequence"), $2, $4, $5);
}
;