Re: ALTER command reworks

From: Kohei KaiGai <kaigai(at)kaigai(dot)gr(dot)jp>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: PgHacker <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: ALTER command reworks
Date: 2012-09-10 11:08:32
Message-ID: CADyhKSUq0ZjZ5+tCJ8Or5fny=ccdSq=z2yrS4JfQOmZY1R2CtA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

2012/8/31 Kohei KaiGai <kaigai(at)kaigai(dot)gr(dot)jp>:
> 2012/8/30 Robert Haas <robertmhaas(at)gmail(dot)com>:
>> On Mon, Aug 13, 2012 at 3:35 PM, Kohei KaiGai <kaigai(at)kaigai(dot)gr(dot)jp> wrote:
>>> The attached patch is a refreshed version of ALTER command
>>> reworks towards the latest tree. Here is few big changes except
>>> for code integration of the code to rename event triggers.
>>
>> This seems to have bit-rotted a bit. Please rebase.
>>
>>> BTW, I had to adjust between oid of pg_largeobject_metadata
>>> and pg_largeobject on three points of this patch, like:
>>>
>>> if (classId == LargeObjectRelationId)
>>> classId = LargeObjectMetadataRelationId;
>>>
>>> When we supported largeobject permission features, we put
>>> special handling to track dependency of its ownership.
>>> The pg_depend records oid of pg_largeobject, instead of
>>> pg_largeobject_metadata. Thus, we cannot use classId of
>>> ObjectAddress being returned from get_object_address()
>>> as an argument of heap_open() as is, if it indicates oid of
>>> pg_largeobject.
>>>
>>> Was it a right decision to track dependency of large object using
>>> oid of pg_largeobject, instead of pg_largeobject_metadata?
>>> IIRC, the reason why we used oid of pg_largeobject is backward
>>> compatibility for applications that tries to reference pg_depend
>>> with built-in oids.
>>
>> I think it was a terrible decision and I'm pretty sure I said as much
>> at the time, but I lost the argument, so I'm inclined to think we're
>> stuck with continuing to support that kludge.
>>
> OK, we will keep to implement carefully...
>
>> Some other preliminary comments:
>>
>> - Surely you need to take AccessExclusiveLock on the object being
>> renamed, not just ShareUpdateExclusiveLock.
>> - I don't think it's acceptable to assemble the object-type
>> "object-name" already exists message using getObjectDescription();
>> it's not good for translators. Use an array of messages, one per
>> object-type, as we have done in other cases.
>> - I would like to handle either the RENAME case or the ALTER OWNER
>> case in one patch, and the other in a follow-on patch. Can you pick
>> one to do first and remove everything related to the other one?
>>
> OK, I'll split the patch into three (isn't it?) portions; RENAME, SET OWNER
> and SET SCHEMA, with all above your suggestions.
>
As attached, I split off the original one into three portions; for set-schema,
set-owner and rename-to. Please apply them in order of patch filename.
Regarding to the error message, RenameErrorMsgAlreadyExists() was added
to handle per object type messages in case when aclcheck_error() is not
available to utilize.
All the regression test is contained with the 1st patch to make sure the
series of reworks does not change existing behaviors.

Thanks,
--
KaiGai Kohei <kaigai(at)kaigai(dot)gr(dot)jp>

Attachment Content-Type Size
pgsql-v9.3-alter-reworks.3-rename.v3.patch application/octet-stream 40.5 KB
pgsql-v9.3-alter-reworks.2-owner.v3.patch application/octet-stream 61.4 KB
pgsql-v9.3-alter-reworks.1-schema.v3.patch application/octet-stream 79.5 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2012-09-10 12:50:42 Re: Supporting plpython 2+3 builds better
Previous Message Nils Goroll 2012-09-10 07:46:36 Re: reviewing the "Reduce sinval synchronization overhead" patch / b4fbe392f8ff6ff1a66b488eb7197eef9e1770a4