aboutsummaryrefslogtreecommitdiff
path: root/src/backend/parser
diff options
context:
space:
mode:
authorAlvaro Herrera <alvherre@alvh.no-ip.org>2023-04-04 14:04:30 +0200
committerAlvaro Herrera <alvherre@alvh.no-ip.org>2023-04-04 14:04:30 +0200
commit71bfd1543f8b68e1013d3e8540b6b5aaf98e02e9 (patch)
tree5d4597a46decc80529836eade41f79f1b812df2a /src/backend/parser
parent8a2b1b147728b11f6df569081d121b9e3135109d (diff)
downloadpostgresql-71bfd1543f8b68e1013d3e8540b6b5aaf98e02e9.tar.gz
postgresql-71bfd1543f8b68e1013d3e8540b6b5aaf98e02e9.zip
Code review for recent SQL/JSON commits
- At the last minute and for no particularly good reason, I changed the WITHOUT token to be marked especially for lookahead, from the one in WITHOUT TIME to the one in WITHOUT UNIQUE. Study of upcoming patches (where a new WITHOUT ARRAY WRAPPER clause is added) showed me that the former was better, so put it back the way the original patch had it. - update exprTypmod() for JsonConstructorExpr to return the typmod of the RETURNING clause, as a comment there suggested. Perhaps it's possible for this to make a difference with datetime types, but I didn't try to build a test case. - The nodeFuncs.c support code for new nodes was calling walker() directly instead of the WALK() macro as introduced by commit 1c27d16e6e5c. Modernize that. Also add exprLocation() support for a couple of nodes that missed it. Lastly, reorder the code more sensibly. The WITHOUT_LA -> WITHOUT change means that stored rules containing either WITHOUT TIME ZONE or WITHOUT UNIQUE KEYS would change representation. Therefore, bump catversion. Discussion: https://postgr.es/m/20230329181708.e64g2tpy7jyufqkr@alvherre.pgsql
Diffstat (limited to 'src/backend/parser')
-rw-r--r--src/backend/parser/gram.y8
-rw-r--r--src/backend/parser/parser.c4
2 files changed, 6 insertions, 6 deletions
diff --git a/src/backend/parser/gram.y b/src/backend/parser/gram.y
index 1b5daf6734b..acf6cf48669 100644
--- a/src/backend/parser/gram.y
+++ b/src/backend/parser/gram.y
@@ -824,7 +824,7 @@ static Node *makeRecursiveViewSelect(char *relname, List *aliases, Node *query);
/* SQL/JSON related keywords */
%nonassoc UNIQUE JSON
%nonassoc KEYS OBJECT_P SCALAR VALUE_P
-%nonassoc WITH WITHOUT_LA
+%nonassoc WITH WITHOUT
/*
* To support target_el without AS, it used to be necessary to assign IDENT an
@@ -14313,7 +14313,7 @@ ConstInterval:
opt_timezone:
WITH_LA TIME ZONE { $$ = true; }
- | WITHOUT TIME ZONE { $$ = false; }
+ | WITHOUT_LA TIME ZONE { $$ = false; }
| /*EMPTY*/ { $$ = false; }
;
@@ -16464,8 +16464,8 @@ json_predicate_type_constraint:
json_key_uniqueness_constraint_opt:
WITH UNIQUE KEYS { $$ = true; }
| WITH UNIQUE { $$ = true; }
- | WITHOUT_LA UNIQUE KEYS { $$ = false; }
- | WITHOUT_LA UNIQUE { $$ = false; }
+ | WITHOUT UNIQUE KEYS { $$ = false; }
+ | WITHOUT UNIQUE { $$ = false; }
| /* EMPTY */ %prec KEYS { $$ = false; }
;
diff --git a/src/backend/parser/parser.c b/src/backend/parser/parser.c
index 65eb0876575..e17c310cc1a 100644
--- a/src/backend/parser/parser.c
+++ b/src/backend/parser/parser.c
@@ -241,10 +241,10 @@ base_yylex(YYSTYPE *lvalp, YYLTYPE *llocp, core_yyscan_t yyscanner)
break;
case WITHOUT:
- /* Replace WITHOUT by WITHOUT_LA if it's followed by UNIQUE */
+ /* Replace WITHOUT by WITHOUT_LA if it's followed by TIME */
switch (next_token)
{
- case UNIQUE:
+ case TIME:
cur_token = WITHOUT_LA;
break;
}