ALTER command reworks
Kohei KaiGai <kaigai@kaigai.gr.jp>
From: Kohei KaiGai <kaigai@kaigai.gr.jp>
To: Robert Haas <robertmhaas@gmail.com>
Cc: PgHacker <pgsql-hackers@postgresql.org>
Date: 2012-07-24T05:24:11Z
Lists: pgsql-hackers
Attachments
- pgsql-v9.3-alter-reworks.v1.patch (application/octet-stream) patch v9
The attached patch is my homework at the last commit fest of v9.2. It consolidates some similar routines into a single generic routines that handles ALTER RENAME TO, OWNER TO and SET SCHEMA according to the ObjectProperty in objectaddress.c, but here is no functionality enhancement. As existing AlterObjectNamespace() doing, this generic routine handles only case when a catalog entry is updated without any extra permission checks or other stuffs. Thus, RenameSchema was not consolidated due to CREATE permission checks towards the database, for example. As patched chunk in commands/alter.c shows, 13 of special routines were consolidated into AlterObjectRename, 16 of special ones were consolidated into AlterObjectNamespace, and 20 of special ones were consolidated into AlterObjectOwner(). My motivation is for minimization of number of places to put object-access-hook around alter statement. Probably, it shall be located around or just after simple_heap_update(). This is a groundwork towards ALTER command support in sepgsql module. Thanks, -- KaiGai Kohei <kaigai@kaigai.gr.jp>