sequence.
<!--
-$Header: /cvsroot/pgsql/doc/src/sgml/ref/create_sequence.sgml,v 1.15 2000/12/08 20:06:58 tgl Exp $
+$Header: /cvsroot/pgsql/doc/src/sgml/ref/create_sequence.sgml,v 1.16 2001/06/23 00:07:33 momjian Exp $
Postgres documentation
-->
<date>1999-07-20</date>
</refsynopsisdivinfo>
<synopsis>
-CREATE SEQUENCE <replaceable class="parameter">seqname</replaceable> [ INCREMENT <replaceable class="parameter">increment</replaceable> ]
+CREATE [ TEMPORARY | TEMP ] SEQUENCE <replaceable class="parameter">seqname</replaceable> [ INCREMENT <replaceable class="parameter">increment</replaceable> ]
[ MINVALUE <replaceable class="parameter">minvalue</replaceable> ] [ MAXVALUE <replaceable class="parameter">maxvalue</replaceable> ]
[ START <replaceable class="parameter">start</replaceable> ] [ CACHE <replaceable class="parameter">cache</replaceable> ] [ CYCLE ]
</synopsis>
</title>
<para>
+ <variablelist>
+ <varlistentry>
+ <term>TEMPORARY or TEMP</term>
+ <listitem>
+ <para>
+ 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.
+ </para>
+ </listitem>
+ </varlistentry>
+
<variablelist>
<varlistentry>
<term><replaceable class="parameter">seqname</replaceable></term>
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/commands/sequence.c,v 1.59 2001/06/13 21:07:12 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/commands/sequence.c,v 1.60 2001/06/23 00:07:34 momjian Exp $
*
*-------------------------------------------------------------------------
*/
}
stmt->relname = seq->seqname;
+ stmt->istemp = seq->istemp;
stmt->inhRelnames = NIL;
stmt->constraints = NIL;
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Header: /cvsroot/pgsql/src/backend/parser/analyze.c,v 1.189 2001/06/04 23:27:23 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/parser/analyze.c,v 1.190 2001/06/23 00:07:34 momjian Exp $
*
*-------------------------------------------------------------------------
*/
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'",
return qry;
}
-/*
+/*
* Transform uses of %TYPE in a statement.
*/
static Node *
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.231 2001/06/19 22:39:11 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.232 2001/06/23 00:07:34 momjian Exp $
*
* HISTORY
* AUTHOR DATE MAJOR EVENT
*
*****************************************************************************/
-CreateSeqStmt: CREATE SEQUENCE relation_name OptSeqList
+CreateSeqStmt: CREATE OptTemp SEQUENCE relation_name OptSeqList
{
CreateSeqStmt *n = makeNode(CreateSeqStmt);
- n->seqname = $3;
- n->options = $4;
+ n->istemp = $2;
+ n->seqname = $4;
+ n->options = $5;
$$ = (Node *)n;
}
;
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: parsenodes.h,v 1.132 2001/06/19 22:39:12 tgl Exp $
+ * $Id: parsenodes.h,v 1.133 2001/06/23 00:07:34 momjian Exp $
*
*-------------------------------------------------------------------------
*/
{
NodeTag type;
char *seqname; /* the relation to create */
+ bool istemp; /* is this a temp sequence? */
List *options;
} CreateSeqStmt;
*
*****************************************************************************/
-CreateSeqStmt: CREATE SEQUENCE relation_name OptSeqList
+CreateSeqStmt: CREATE OptTemp SEQUENCE relation_name OptSeqList
{
- $$ = cat_str(3, make_str("create sequence"), $3, $4);
+ $$ = cat_str(4, make_str("create sequence"), $2, $4, $5);
}
;