Re: [v9.2] DROP statement reworks

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: Re: [v9.2] DROP statement reworks
Date: 2011-10-12 12:53:32
Message-ID: CADyhKSUmH5F_yuUgtj5bEpcfJ8cx3LJGvco8Nkkfw_+eTRWPTw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

2011/10/12 Robert Haas <robertmhaas(at)gmail(dot)com>:
> On Wed, Oct 12, 2011 at 8:07 AM, Kohei KaiGai <kaigai(at)kaigai(dot)gr(dot)jp> wrote:
>> I'm currently trying to revise my patches according to your suggestions,
>> but I'm facing a trouble about error messages when user tries to drop
>> a non-exists object.
>>
>> Because the ObjectProperty array has an entry for each catalogs, it is
>> unavailable to hold the name of object type (such as "table" or "index")
>> when multiple object types are associated with a particular system
>> catalog, such as pg_class, pg_type or pg_proc.
>>
>> How should I implement the following block?
>>
>>        if (!OidIsValid(address.objectId))
>>        {
>>            ereport(NOTICE,
>>                    (errmsg("%s \"%s\" does not exist, skipping",
>>                            get_object_property_typetext(stmt->removeType),
>>                            NameListToString(objname))));
>>            continue;
>>        }
>>
>> One idea is to add a separated array to translate from OBJECT_* to
>> its text representation. (Maybe, it can be used to translattions with
>> opposite direction.)
>
> For reasons of translation, you can't do something like "%s \"%s\"
> does not exist, skipping".  Instead I think you need an array that
> works something like dropmsgstringarray[], but based on the OBJECT_*
> constants rather than the RELKIND_* constants.  IOW, it maps the
> object type to the full error message, not just the name of the object
> type.
>
OK, I'll revise the code based on this idea.

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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2011-10-12 13:13:20 Re: [BUGS] *.sql contrib files contain unresolvable MODULE_PATHNAME
Previous Message Robert Haas 2011-10-12 12:46:38 Re: [v9.2] DROP statement reworks