From c14a43f657c33189582ca1a7a60ab419dc6164a5 Mon Sep 17 00:00:00 2001 From: Tom Lane <tgl@sss.pgh.pa.us> Date: Mon, 12 Jul 2004 05:38:11 +0000 Subject: [PATCH] Remove TABLESPACE option of CREATE SEQUENCE; sequences will now always live in database or schema's default tablespace, as per today's discussion. Also, remove some unused keywords from the grammar (PATH, PENDANT, VERSION), and fix ALSO, which was added as a keyword but not added to the keyword classification lists, thus making it worse-than-reserved. --- doc/src/sgml/ref/create_sequence.sgml | 16 +--------------- src/backend/commands/sequence.c | 4 ++-- src/backend/nodes/copyfuncs.c | 3 +-- src/backend/nodes/equalfuncs.c | 3 +-- src/backend/parser/analyze.c | 3 +-- src/backend/parser/gram.y | 15 ++++++--------- src/backend/parser/keywords.c | 5 +---- src/bin/pg_dump/pg_dump.c | 11 +---------- src/include/nodes/parsenodes.h | 3 +-- 9 files changed, 15 insertions(+), 48 deletions(-) diff --git a/doc/src/sgml/ref/create_sequence.sgml b/doc/src/sgml/ref/create_sequence.sgml index de9fa57ee1..d380d32a72 100644 --- a/doc/src/sgml/ref/create_sequence.sgml +++ b/doc/src/sgml/ref/create_sequence.sgml @@ -1,5 +1,5 @@ <!-- -$PostgreSQL: pgsql/doc/src/sgml/ref/create_sequence.sgml,v 1.40 2004/06/18 06:13:05 tgl Exp $ +$PostgreSQL: pgsql/doc/src/sgml/ref/create_sequence.sgml,v 1.41 2004/07/12 05:36:56 tgl Exp $ PostgreSQL documentation --> @@ -23,7 +23,6 @@ PostgreSQL documentation CREATE [ TEMPORARY | TEMP ] SEQUENCE <replaceable class="parameter">name</replaceable> [ INCREMENT [ BY ] <replaceable class="parameter">increment</replaceable> ] [ MINVALUE <replaceable class="parameter">minvalue</replaceable> | NO MINVALUE ] [ MAXVALUE <replaceable class="parameter">maxvalue</replaceable> | NO MAXVALUE ] [ START [ WITH ] <replaceable class="parameter">start</replaceable> ] [ CACHE <replaceable class="parameter">cache</replaceable> ] [ [ NO ] CYCLE ] - [ TABLESPACE <replaceable class="parameter">tablespace</replaceable> ] </synopsis> </refsynopsisdiv> @@ -194,19 +193,6 @@ SELECT * FROM <replaceable>name</replaceable>; </para> </listitem> </varlistentry> - - <varlistentry> - <term><replaceable class="parameter">tablespace</replaceable></term> - <listitem> - <para> - The optional clause <literal>TABLESPACE</> <replaceable - class="parameter">tablespace</replaceable> specifies - the tablespace in which to create the sequence. If this clause - is not supplied, the tablespace of the sequence's schema will be used. - </para> - </listitem> - </varlistentry> - </variablelist> </refsect1> diff --git a/src/backend/commands/sequence.c b/src/backend/commands/sequence.c index 1b6538b539..dc66314afe 100644 --- a/src/backend/commands/sequence.c +++ b/src/backend/commands/sequence.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/commands/sequence.c,v 1.112 2004/06/18 06:13:23 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/commands/sequence.c,v 1.113 2004/07/12 05:37:03 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -180,7 +180,7 @@ DefineSequence(CreateSeqStmt *seq) stmt->constraints = NIL; stmt->hasoids = MUST_NOT_HAVE_OIDS; stmt->oncommit = ONCOMMIT_NOOP; - stmt->tablespacename = seq->tablespacename; + stmt->tablespacename = NULL; seqoid = DefineRelation(stmt, RELKIND_SEQUENCE); diff --git a/src/backend/nodes/copyfuncs.c b/src/backend/nodes/copyfuncs.c index 17adc9cf5f..8c550f4911 100644 --- a/src/backend/nodes/copyfuncs.c +++ b/src/backend/nodes/copyfuncs.c @@ -15,7 +15,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/nodes/copyfuncs.c,v 1.287 2004/06/25 21:55:54 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/nodes/copyfuncs.c,v 1.288 2004/07/12 05:37:21 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -2152,7 +2152,6 @@ _copyCreateSeqStmt(CreateSeqStmt *from) COPY_NODE_FIELD(sequence); COPY_NODE_FIELD(options); - COPY_STRING_FIELD(tablespacename); return newnode; } diff --git a/src/backend/nodes/equalfuncs.c b/src/backend/nodes/equalfuncs.c index f46c7b4420..e2d4d16c78 100644 --- a/src/backend/nodes/equalfuncs.c +++ b/src/backend/nodes/equalfuncs.c @@ -18,7 +18,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/nodes/equalfuncs.c,v 1.226 2004/06/25 21:55:54 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/nodes/equalfuncs.c,v 1.227 2004/07/12 05:37:24 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -1170,7 +1170,6 @@ _equalCreateSeqStmt(CreateSeqStmt *a, CreateSeqStmt *b) { COMPARE_NODE_FIELD(sequence); COMPARE_NODE_FIELD(options); - COMPARE_STRING_FIELD(tablespacename); return true; } diff --git a/src/backend/parser/analyze.c b/src/backend/parser/analyze.c index 5450103156..1c7be76e72 100644 --- a/src/backend/parser/analyze.c +++ b/src/backend/parser/analyze.c @@ -6,7 +6,7 @@ * Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/backend/parser/analyze.c,v 1.306 2004/06/18 06:13:31 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/parser/analyze.c,v 1.307 2004/07/12 05:37:44 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -874,7 +874,6 @@ transformColumnDefinition(ParseState *pstate, CreateStmtContext *cxt, seqstmt = makeNode(CreateSeqStmt); seqstmt->sequence = makeRangeVar(snamespace, sname); seqstmt->options = NIL; - seqstmt->tablespacename = NULL; cxt->blist = lappend(cxt->blist, seqstmt); diff --git a/src/backend/parser/gram.y b/src/backend/parser/gram.y index e9af75baaa..519bcce718 100644 --- a/src/backend/parser/gram.y +++ b/src/backend/parser/gram.y @@ -11,7 +11,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/parser/gram.y,v 2.466 2004/07/11 23:13:54 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/parser/gram.y,v 2.467 2004/07/12 05:37:44 tgl Exp $ * * HISTORY * AUTHOR DATE MAJOR EVENT @@ -380,7 +380,7 @@ static void doNegateFloat(Value *v); OBJECT_P OF OFF OFFSET OIDS OLD ON ONLY OPERATOR OPTION OR ORDER OUT_P OUTER_P OVERLAPS OVERLAY OWNER - PARTIAL PASSWORD PATH_P PENDANT PLACING POSITION + PARTIAL PASSWORD PLACING POSITION PRECISION PRESERVE PREPARE PRIMARY PRIOR PRIVILEGES PROCEDURAL PROCEDURE @@ -403,7 +403,7 @@ static void doNegateFloat(Value *v); UPDATE USAGE USER USING VACUUM VALID VALIDATOR VALUES VARCHAR VARYING - VERBOSE VERSION VIEW VOLATILE + VERBOSE VIEW VOLATILE WHEN WHERE WITH WITHOUT WORK WRITE @@ -417,7 +417,7 @@ static void doNegateFloat(Value *v); */ %token UNIONJOIN -/* Special keywords, not in the query language - see the "lex" file */ +/* Special token types, not actually keywords - see the "lex" file */ %token <str> IDENT FCONST SCONST BCONST XCONST Op %token <ival> ICONST PARAM @@ -1994,13 +1994,12 @@ CreateAsElement: *****************************************************************************/ CreateSeqStmt: - CREATE OptTemp SEQUENCE qualified_name OptSeqList OptTableSpace + CREATE OptTemp SEQUENCE qualified_name OptSeqList { CreateSeqStmt *n = makeNode(CreateSeqStmt); $4->istemp = $2; n->sequence = $4; n->options = $5; - n->tablespacename = $6; $$ = (Node *)n; } ; @@ -7572,6 +7571,7 @@ unreserved_keyword: | ADD | AFTER | AGGREGATE + | ALSO | ALTER | ASSERTION | ASSIGNMENT @@ -7677,8 +7677,6 @@ unreserved_keyword: | OWNER | PARTIAL | PASSWORD - | PATH_P - | PENDANT | PREPARE | PRESERVE | PRIOR @@ -7743,7 +7741,6 @@ unreserved_keyword: | VALIDATOR | VALUES | VARYING - | VERSION | VIEW | VOLATILE | WITH diff --git a/src/backend/parser/keywords.c b/src/backend/parser/keywords.c index a89f8da7d4..cae1ed159b 100644 --- a/src/backend/parser/keywords.c +++ b/src/backend/parser/keywords.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/parser/keywords.c,v 1.150 2004/06/18 06:13:31 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/parser/keywords.c,v 1.151 2004/07/12 05:37:44 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -237,8 +237,6 @@ static const ScanKeyword ScanKeywords[] = { {"owner", OWNER}, {"partial", PARTIAL}, {"password", PASSWORD}, - {"path", PATH_P}, - {"pendant", PENDANT}, {"placing", PLACING}, {"position", POSITION}, {"precision", PRECISION}, @@ -333,7 +331,6 @@ static const ScanKeyword ScanKeywords[] = { {"varchar", VARCHAR}, {"varying", VARYING}, {"verbose", VERBOSE}, - {"version", VERSION}, {"view", VIEW}, {"volatile", VOLATILE}, {"when", WHEN}, diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c index 00793ebbce..c01ea6ad5b 100644 --- a/src/bin/pg_dump/pg_dump.c +++ b/src/bin/pg_dump/pg_dump.c @@ -12,7 +12,7 @@ * by PostgreSQL * * IDENTIFICATION - * $PostgreSQL: pgsql/src/bin/pg_dump/pg_dump.c,v 1.377 2004/06/25 17:20:26 tgl Exp $ + * $PostgreSQL: pgsql/src/bin/pg_dump/pg_dump.c,v 1.378 2004/07/12 05:37:53 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -7298,15 +7298,6 @@ dumpSequence(Archive *fout, TableInfo *tbinfo) " CACHE %s%s", cache, (cycled ? "\n CYCLE" : "")); - /* Output tablespace clause if necessary */ - if (strlen(tbinfo->reltablespace) != 0 && - strcmp(tbinfo->reltablespace, - tbinfo->dobj.namespace->nsptablespace) != 0) - { - appendPQExpBuffer(query, " TABLESPACE %s", - fmtId(tbinfo->reltablespace)); - } - appendPQExpBuffer(query, ";\n"); ArchiveEntry(fout, tbinfo->dobj.catId, tbinfo->dobj.dumpId, diff --git a/src/include/nodes/parsenodes.h b/src/include/nodes/parsenodes.h index 3745972bd5..47b09b42a7 100644 --- a/src/include/nodes/parsenodes.h +++ b/src/include/nodes/parsenodes.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/nodes/parsenodes.h,v 1.261 2004/07/11 23:13:58 tgl Exp $ + * $PostgreSQL: pgsql/src/include/nodes/parsenodes.h,v 1.262 2004/07/12 05:38:11 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -1165,7 +1165,6 @@ typedef struct CreateSeqStmt NodeTag type; RangeVar *sequence; /* the sequence to create */ List *options; - char *tablespacename; /* tablespace, or NULL for default */ } CreateSeqStmt; typedef struct AlterSeqStmt