public inbox for [email protected]
help / color / mirror / Atom feedFrom: Alexey Kondratov <[email protected]>
Subject: [PATCH v29 1/7] Refactor gram.y in order to add a common parenthesized option list
Date: Wed, 2 Sep 2020 23:05:16 +0300
Previously there were two identical option lists
(explain_option_list and vac_analyze_option_list) + very similar
reindex_option_list. It does not seem to make
sense to maintain identical option lists in the grammar, since
all new options are added and parsed in the backend code.
That way, new common_option_list added in order to replace all
explain_option_list, vac_analyze_option_list and probably
also reindex_option_list.
---
src/backend/parser/gram.y | 61 +++++++++------------------------------
1 file changed, 14 insertions(+), 47 deletions(-)
diff --git a/src/backend/parser/gram.y b/src/backend/parser/gram.y
index 480d168346..0828c27944 100644
--- a/src/backend/parser/gram.y
+++ b/src/backend/parser/gram.y
@@ -315,10 +315,10 @@ static Node *makeRecursiveViewSelect(char *relname, List *aliases, Node *query);
create_extension_opt_item alter_extension_opt_item
%type <ival> opt_lock lock_type cast_context
-%type <str> vac_analyze_option_name
-%type <defelt> vac_analyze_option_elem
-%type <list> vac_analyze_option_list
-%type <node> vac_analyze_option_arg
+%type <str> common_option_name
+%type <defelt> common_option_elem
+%type <list> common_option_list
+%type <node> common_option_arg
%type <defelt> drop_option
%type <boolean> opt_or_replace opt_no
opt_grant_grant_option opt_grant_admin_option
@@ -513,10 +513,6 @@ static Node *makeRecursiveViewSelect(char *relname, List *aliases, Node *query);
%type <node> generic_option_arg
%type <defelt> generic_option_elem alter_generic_option_elem
%type <list> generic_option_list alter_generic_option_list
-%type <str> explain_option_name
-%type <node> explain_option_arg
-%type <defelt> explain_option_elem
-%type <list> explain_option_list
%type <ival> reindex_target_type reindex_target_multitable
%type <ival> reindex_option_list reindex_option_elem
@@ -10485,7 +10481,7 @@ VacuumStmt: VACUUM opt_full opt_freeze opt_verbose opt_analyze opt_vacuum_relati
n->is_vacuumcmd = true;
$$ = (Node *)n;
}
- | VACUUM '(' vac_analyze_option_list ')' opt_vacuum_relation_list
+ | VACUUM '(' common_option_list ')' opt_vacuum_relation_list
{
VacuumStmt *n = makeNode(VacuumStmt);
n->options = $3;
@@ -10506,7 +10502,7 @@ AnalyzeStmt: analyze_keyword opt_verbose opt_vacuum_relation_list
n->is_vacuumcmd = false;
$$ = (Node *)n;
}
- | analyze_keyword '(' vac_analyze_option_list ')' opt_vacuum_relation_list
+ | analyze_keyword '(' common_option_list ')' opt_vacuum_relation_list
{
VacuumStmt *n = makeNode(VacuumStmt);
n->options = $3;
@@ -10516,12 +10512,12 @@ AnalyzeStmt: analyze_keyword opt_verbose opt_vacuum_relation_list
}
;
-vac_analyze_option_list:
- vac_analyze_option_elem
+common_option_list:
+ common_option_elem
{
$$ = list_make1($1);
}
- | vac_analyze_option_list ',' vac_analyze_option_elem
+ | common_option_list ',' common_option_elem
{
$$ = lappend($1, $3);
}
@@ -10532,19 +10528,19 @@ analyze_keyword:
| ANALYSE /* British */ {}
;
-vac_analyze_option_elem:
- vac_analyze_option_name vac_analyze_option_arg
+common_option_elem:
+ common_option_name common_option_arg
{
$$ = makeDefElem($1, $2, @1);
}
;
-vac_analyze_option_name:
+common_option_name:
NonReservedWord { $$ = $1; }
| analyze_keyword { $$ = "analyze"; }
;
-vac_analyze_option_arg:
+common_option_arg:
opt_boolean_or_string { $$ = (Node *) makeString($1); }
| NumericOnly { $$ = (Node *) $1; }
| /* EMPTY */ { $$ = NULL; }
@@ -10626,7 +10622,7 @@ ExplainStmt:
n->options = list_make1(makeDefElem("verbose", NULL, @2));
$$ = (Node *) n;
}
- | EXPLAIN '(' explain_option_list ')' ExplainableStmt
+ | EXPLAIN '(' common_option_list ')' ExplainableStmt
{
ExplainStmt *n = makeNode(ExplainStmt);
n->query = $5;
@@ -10647,35 +10643,6 @@ ExplainableStmt:
| ExecuteStmt /* by default all are $$=$1 */
;
-explain_option_list:
- explain_option_elem
- {
- $$ = list_make1($1);
- }
- | explain_option_list ',' explain_option_elem
- {
- $$ = lappend($1, $3);
- }
- ;
-
-explain_option_elem:
- explain_option_name explain_option_arg
- {
- $$ = makeDefElem($1, $2, @1);
- }
- ;
-
-explain_option_name:
- NonReservedWord { $$ = $1; }
- | analyze_keyword { $$ = "analyze"; }
- ;
-
-explain_option_arg:
- opt_boolean_or_string { $$ = (Node *) makeString($1); }
- | NumericOnly { $$ = (Node *) $1; }
- | /* EMPTY */ { $$ = NULL; }
- ;
-
/*****************************************************************************
*
* QUERY:
--
2.17.0
--k1lZvvs/B4yU6o8G
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment;
filename="v29-0002-Change-REINDEX-CLUSTER-to-accept-an-option-list.patch"
view thread (20+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected]
Subject: Re: [PATCH v29 1/7] Refactor gram.y in order to add a common parenthesized option list
In-Reply-To: <no-message-id-1864653@localhost>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox