Refactoring on DROP/ALTER SET SCHEMA/ALTER RENAME TO statement

From: Kohei KaiGai <kaigai(at)kaigai(dot)gr(dot)jp>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Dimitri Fontaine <dimitri(at)2ndquadrant(dot)fr>, PgHacker <pgsql-hackers(at)postgresql(dot)org>
Subject: Refactoring on DROP/ALTER SET SCHEMA/ALTER RENAME TO statement
Date: 2011-11-15 09:43:54
Message-ID: CADyhKSW0QnaUdfNM6girKSuieWzONN1aUgUTgcG+yooLQXO_rw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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(at)kaigai(dot)gr(dot)jp>

Attachment Content-Type Size
pgsql-v9.2-ddl-refactoring-part-4.v1.alter-rename-to.patch application/octet-stream 47.5 KB
pgsql-v9.2-ddl-refactoring-part-3.v1.alter-set-schema.patch application/octet-stream 44.0 KB
pgsql-v9.2-ddl-refactoring-part-2.v1.groundworks.patch application/octet-stream 51.1 KB
pgsql-v9.2-ddl-refactoring-part-1.v1.drop-stmt.patch application/octet-stream 63.4 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Yeb Havinga 2011-11-15 10:17:37 Re: [REVIEW] Patch for cursor calling with named parameters
Previous Message Torello Querci 2011-11-15 09:31:23 Re: ToDo: pg_backup - using a conditional DROP