From: | Nathan Bossart <nathandbossart(at)gmail(dot)com> |
---|---|
To: | Álvaro Herrera <alvherre(at)kurilemu(dot)de> |
Cc: | Andres Freund <andres(at)anarazel(dot)de>, Pg Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Re: trivial grammar refactor |
Date: | 2025-07-24 14:31:32 |
Message-ID: | aIJDxMQeNa8OQC4f@nathan |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Thu, Jul 24, 2025 at 11:54:10AM +0200, Álvaro Herrera wrote:
> Yeah, thanks for taking a look. That duplication is just me being dumb.
> Here's a version without that. The only thing that needed to change was
> changing "CLUSTER opt_verbose" to "CLUSTER VERBOSE" so that the
> unadorned CLUSTER is handled by "CLUSTER opt_utility_option_list"
> instead.
I think we can do something similar for ANALYZE. But AFAICT you're right
that we can't use it for VACUUM and EXPLAIN, at least not easily.
diff --git a/src/backend/parser/gram.y b/src/backend/parser/gram.y
index fc9a8d64c08..7d341a319e7 100644
--- a/src/backend/parser/gram.y
+++ b/src/backend/parser/gram.y
@@ -11987,24 +11987,21 @@ VacuumStmt: VACUUM opt_full opt_freeze opt_verbose opt_analyze opt_vacuum_relati
}
;
-AnalyzeStmt: analyze_keyword opt_verbose opt_vacuum_relation_list
+AnalyzeStmt: analyze_keyword opt_utility_option_list opt_vacuum_relation_list
{
VacuumStmt *n = makeNode(VacuumStmt);
- n->options = NIL;
- if ($2)
- n->options = lappend(n->options,
- makeDefElem("verbose", NULL, @2));
+ n->options = $2;
n->rels = $3;
n->is_vacuumcmd = false;
$$ = (Node *) n;
}
- | analyze_keyword '(' utility_option_list ')' opt_vacuum_relation_list
+ | analyze_keyword VERBOSE opt_vacuum_relation_list
{
VacuumStmt *n = makeNode(VacuumStmt);
- n->options = $3;
- n->rels = $5;
+ n->options = list_make1(makeDefElem("verbose", NULL, @2));
+ n->rels = $3;
n->is_vacuumcmd = false;
$$ = (Node *) n;
}
--
nathan
From | Date | Subject | |
---|---|---|---|
Next Message | Robert Haas | 2025-07-24 14:38:49 | Re: Adding wait events statistics |
Previous Message | Mircea Cadariu | 2025-07-24 14:30:06 | Re: Add os_page_num to pg_buffercache |