From 0303e7b31fa32c8ac4dc0414babed1c321dc7567 Mon Sep 17 00:00:00 2001
From: Alvaro Herrera <alvherre@alvh.no-ip.org>
Date: Wed, 29 Mar 2023 20:09:12 +0200
Subject: [PATCH v13 2/3] backtrack on making WITHOUT_LA be for UNIQUE rather
 than TIME

---
 src/backend/parser/gram.y            | 8 ++++----
 src/backend/parser/parser.c          | 4 ++--
 src/interfaces/ecpg/preproc/parser.c | 4 ++--
 3 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/backend/parser/gram.y b/src/backend/parser/gram.y
index eeb3d7b225..356ee2908f 100644
--- a/src/backend/parser/gram.y
+++ b/src/backend/parser/gram.y
@@ -826,7 +826,7 @@ static Node *makeRecursiveViewSelect(char *relname, List *aliases, Node *query);
 %nonassoc	UNIQUE JSON
 %nonassoc	KEYS						/* UNIQUE [ KEYS ] */
 %nonassoc	OBJECT_P SCALAR VALUE_P		/* JSON [ OBJECT | SCALAR | VALUE ] */
-%nonassoc	WITHOUT_LA WITH_UNIQUE_LA
+%nonassoc	WITHOUT WITH_UNIQUE_LA
 
 /*
  * To support target_el without AS, it used to be necessary to assign IDENT an
@@ -14320,7 +14320,7 @@ ConstInterval:
 
 opt_timezone:
 			WITH_LA TIME ZONE						{ $$ = true; }
-			| WITHOUT TIME ZONE						{ $$ = false; }
+			| WITHOUT_LA TIME ZONE					{ $$ = false; }
 			| /*EMPTY*/								{ $$ = false; }
 		;
 
@@ -16473,8 +16473,8 @@ json_predicate_type_constraint:
 json_key_uniqueness_constraint_opt:
 			WITH_UNIQUE_LA UNIQUE KEYS					{ $$ = true; }
 			| WITH_UNIQUE_LA 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 0520459031..d072c2cb90 100644
--- a/src/backend/parser/parser.c
+++ b/src/backend/parser/parser.c
@@ -245,10 +245,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;
 			}
diff --git a/src/interfaces/ecpg/preproc/parser.c b/src/interfaces/ecpg/preproc/parser.c
index 30010a5706..0754af7d22 100644
--- a/src/interfaces/ecpg/preproc/parser.c
+++ b/src/interfaces/ecpg/preproc/parser.c
@@ -162,10 +162,10 @@ filtered_base_yylex(void)
 			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;
 			}
-- 
2.30.2

