Skip to content

Commit dd57547

Browse files
committed
made PARTITION keyword unreserved again
1 parent 6290f6b commit dd57547

File tree

3 files changed

+27
-6
lines changed

3 files changed

+27
-6
lines changed

src/backend/parser/gram.y

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -673,7 +673,7 @@ static Node *makeRecursiveViewSelect(char *relname, List *aliases, Node *query);
673673
* as NOT, at least with respect to their left-hand subexpression.
674674
* NULLS_LA and WITH_LA are needed to make the grammar LALR(1).
675675
*/
676-
%token NOT_LA NULLS_LA WITH_LA
676+
%token NOT_LA NULLS_LA WITH_LA ADD_PARTITION DROP_PARTITION RENAME_PARTITION
677677

678678

679679
/* Precedence: lowest to highest */
@@ -2391,7 +2391,7 @@ alter_table_cmd:
23912391
n->def = (Node *)$1;
23922392
$$ = (Node *) n;
23932393
}
2394-
| ADD_P OptRangePartitionsListElement
2394+
| ADD_PARTITION OptRangePartitionsListElement
23952395
{
23962396
AlterTableCmd *n = makeNode(AlterTableCmd);
23972397
n->subtype = AT_AddPartition;
@@ -2440,15 +2440,15 @@ alter_table_cmd:
24402440

24412441
$$ = (Node *) n;
24422442
}
2443-
| RENAME PARTITION relation_expr TO name
2443+
| RENAME_PARTITION PARTITION relation_expr TO name
24442444
{
24452445
AlterTableCmd *n = makeNode(AlterTableCmd);
24462446
n->subtype = AT_RenamePartition;
24472447
n->partitions = list_make1($3);
24482448
n->name = $5;
24492449
$$ = (Node *)n;
24502450
}
2451-
| DROP PARTITION qualified_name
2451+
| DROP_PARTITION PARTITION qualified_name
24522452
{
24532453
AlterTableCmd *n = makeNode(AlterTableCmd);
24542454
n->subtype = AT_DropPartition;
@@ -14251,6 +14251,7 @@ unreserved_keyword:
1425114251
| PARALLEL
1425214252
| PARSER
1425314253
| PARTIAL
14254+
| PARTITION
1425414255
| PARTITIONS
1425514256
| PASSING
1425614257
| PASSWORD
@@ -14527,7 +14528,6 @@ reserved_keyword:
1452714528
| ONLY
1452814529
| OR
1452914530
| ORDER
14530-
| PARTITION
1453114531
| PLACING
1453214532
| PRIMARY
1453314533
| REFERENCES

src/backend/parser/parser.c

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,15 @@ base_yylex(YYSTYPE *lvalp, YYLTYPE *llocp, core_yyscan_t yyscanner)
116116
case WITH:
117117
cur_token_length = 4;
118118
break;
119+
case ADD_P:
120+
cur_token_length = 3;
121+
break;
122+
case DROP:
123+
cur_token_length = 4;
124+
break;
125+
case RENAME:
126+
cur_token_length = 6;
127+
break;
119128
default:
120129
return cur_token;
121130
}
@@ -189,6 +198,18 @@ base_yylex(YYSTYPE *lvalp, YYLTYPE *llocp, core_yyscan_t yyscanner)
189198
break;
190199
}
191200
break;
201+
case ADD_P:
202+
if (next_token == PARTITION)
203+
cur_token = ADD_PARTITION;
204+
break;
205+
case DROP:
206+
if (next_token == PARTITION)
207+
cur_token = DROP_PARTITION;
208+
break;
209+
case RENAME:
210+
if (next_token == PARTITION)
211+
cur_token = RENAME_PARTITION;
212+
break;
192213
}
193214

194215
return cur_token;

src/include/parser/kwlist.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ PG_KEYWORD("owner", OWNER, UNRESERVED_KEYWORD)
292292
PG_KEYWORD("parallel", PARALLEL, UNRESERVED_KEYWORD)
293293
PG_KEYWORD("parser", PARSER, UNRESERVED_KEYWORD)
294294
PG_KEYWORD("partial", PARTIAL, UNRESERVED_KEYWORD)
295-
PG_KEYWORD("partition", PARTITION, RESERVED_KEYWORD)
295+
PG_KEYWORD("partition", PARTITION, UNRESERVED_KEYWORD)
296296
PG_KEYWORD("partitions", PARTITIONS, UNRESERVED_KEYWORD)
297297
PG_KEYWORD("passing", PASSING, UNRESERVED_KEYWORD)
298298
PG_KEYWORD("password", PASSWORD, UNRESERVED_KEYWORD)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy