some grammar refactoring

From: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: some grammar refactoring
Date: 2020-05-19 06:43:27
Message-ID: 163c00a5-f634-ca52-fc7c-0e53deda8735@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Here is a series of patches to do some refactoring in the grammar around
the commands COMMENT, DROP, SECURITY LABEL, and ALTER EXTENSION ...
ADD/DROP. In the grammar, these commands (with some exceptions)
basically just take a reference to an object and later look it up in C
code. Some of that was already generalized individually for each
command (drop_type_any_name, drop_type_name, etc.). This patch combines
it into common lists for all these commands.

Advantages:

- Avoids having to list each object type at least four times.

- Object types not supported by security labels or extensions are now
explicitly listed and give a proper error message. Previously, this was
just encoded in the grammar itself and specifying a non-supported object
type would just give a parse error.

- Reduces lines of code in gram.y.

- Removes some old cruft.

--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

Attachment Content-Type Size
v1-0001-Remove-redundant-grammar-symbols.patch text/plain 13.9 KB
v1-0002-Fold-AlterForeignTableStmt-into-AlterTableStmt.patch text/plain 3.0 KB
v1-0003-Remove-deprecated-syntax-from-CREATE-DROP-LANGUAG.patch text/plain 3.3 KB
v1-0004-Refactor-DROP-LANGUAGE-grammar.patch text/plain 2.4 KB
v1-0005-Grammar-object-type-refactoring.patch text/plain 13.4 KB
v1-0006-Refactor-AlterExtensionContentsStmt-grammar.patch text/plain 9.0 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Grillet 2020-05-19 06:44:57 Re: Add A Glossary
Previous Message Pavan Deolasee 2020-05-19 06:31:35 pg_dump dumps row level policies on extension tables