Skip site navigation (1) Skip section navigation (2)

Re: ALTER command reworks

From: Kohei KaiGai <kaigai(at)kaigai(dot)gr(dot)jp>
To: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, PgHacker <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: ALTER command reworks
Date: 2012-11-15 18:44:46
Message-ID: CADyhKSVScSr7wg1oGcyVX_pfcwt9wQq5DZ+4Geag4NwEdP5-6w@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-hackers
The attached patch is the revised version of ALTER RENAME TO
consolidation. According to the previous suggestion, it uses
a common logic to check object-naming duplication at
check_duplicate_objectname().

At the code path on AlterObjectNamespace_internal, it lost
ObjectType information to the supplied object, so I also added
get_object_type() function at objectaddress.c for inverse
translation from a couple of classId/objectId to OBJECT_* label.

Rest of parts are unchanged since the previous versions.

Thanks,

2012/10/17 Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>:
> Kohei KaiGai escribi├│:
>> 2012/10/5 Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>:
>
>> The attached patch fixes the messaging issue.
>> I newly add func_signature_string_oid() that returns compatible function's
>> signature, but takes its object-id.
>>
>> So, the error message is now constructed as:
>> +       case OBJECT_AGGREGATE:
>> +       case OBJECT_FUNCTION:
>> +           errorm = format_elog_string("function %s already exists in
>> schema \"%s\"",
>> +                                       func_signature_string_oid(objectId),
>> +                                       get_namespace_name(namespaceId));
>> +            break;
>
> Thanks, yeah, this works for me.
>
> I am now wondering if it would make sense to merge the duplicate-name
> error cases in AlterObjectNamespace_internal and
> AlterObjectRename_internal.  The former only works when there is a name
> catcache for the object type.  Maybe we can create a single function to
> which we give the object type, name/args, oid, etc, and it uses a
> catcache if available and falls back to get_object_address (with the
> IMO ugly name list manipulations) if not.
>
> --
> ─«lvaro Herrera                http://www.2ndQuadrant.com/
> PostgreSQL Development, 24x7 Support, Training & Services



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

Attachment: pgsql-v9.3-alter-reworks.3-rename.v6.patch
Description: application/octet-stream (52.6 KB)

In response to

Responses

pgsql-hackers by date

Next:From: Robert HaasDate: 2012-11-15 19:13:13
Subject: Re: WIP patch: add (PRE|POST)PROCESSOR options to COPY
Previous:From: Josh BerkusDate: 2012-11-15 18:38:53
Subject: Re: another idea for changing global configuration settings from SQL

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group