some grammar refactoring

Peter Eisentraut <peter.eisentraut@2ndquadrant.com>

From: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
To: pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2020-05-19T06:43:27Z
Lists: pgsql-hackers

Attachments

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

Commits

  1. Grammar object type refactoring

  2. Refactor AlterExtensionContentsStmt grammar

  3. Refactor DROP LANGUAGE grammar

  4. Remove deprecated syntax from CREATE/DROP LANGUAGE

  5. Fold AlterForeignTableStmt into AlterTableStmt

  6. Remove redundant grammar symbols