Refactoring on DROP/ALTER SET SCHEMA/ALTER RENAME TO statement
Kohei KaiGai <kaigai@kaigai.gr.jp>
From: Kohei KaiGai <kaigai@kaigai.gr.jp>
To: Robert Haas <robertmhaas@gmail.com>
Cc: Dimitri Fontaine <dimitri@2ndquadrant.fr>, PgHacker <pgsql-hackers@postgresql.org>
Date: 2011-11-15T09:43:54Z
Lists: pgsql-hackers
Attachments
- pgsql-v9.2-ddl-refactoring-part-4.v1.alter-rename-to.patch (application/octet-stream) patch v9
- pgsql-v9.2-ddl-refactoring-part-3.v1.alter-set-schema.patch (application/octet-stream) patch v9
- pgsql-v9.2-ddl-refactoring-part-2.v1.groundworks.patch (application/octet-stream) patch v9
- pgsql-v9.2-ddl-refactoring-part-1.v1.drop-stmt.patch (application/octet-stream) patch v9
The series of attached patches try to have refactoring on several ddl statements; that consolidates distributed routines for each object types into a common routine to minimize the number of upcoming hooks for external security. Please apply the series of patches in order of part-1, part-2, part-3 then part-4. Part-1) DROP statement refactoring It is a remaining portion of what I submitted in the last commit fest. It allows object types that didn't used DropStmt in gram.y to go through RemoveObjects(), instead of individual RemoveXXXX(). Part-2) Groundworks on objectaddress.c This patch adds necessary groundworks for Part-3 and Part-4. It adds ObjectPropertyType of objectaddress.c index-oid and cache-id for name lookup and attribute number of object name; these field is used to detect namespace conflict on object_exists_namespace() that shall be called on refactored ALTER SET SCHEMA/RENAME TO. It also reduce some arguments of check_object_ownership(), and allows to call this function without knowledge of ObjectType and text representation. It allows to check ownership using this function from the code path of AlterObjectNamespace_oid() that does not have (or need to look up catalog to obtain) ObjectType information. In addition, it adds regression test cases for ALTER SET SCHEMA/RENAME TO. Part-3) ALTER SET SCHEMA statement refactoring This patch refactoring routines of ALTER SET SCHEMA implementations of most object types; except for relations, types and extensions. This portion was originally designed to use a common routine (AlterObjectNamespace) via wrapper function that delivers characteristic properties of object types, then this design was replaced by facilities of objectaddress.c. Part-4) ALTER RENAME TO statement refactoring This patch refactoring routines of ALTER RENAME TO implementation of most object types; except for databases, relations, columns, triggers and roles. Thanks, -- KaiGai Kohei <kaigai@kaigai.gr.jp>