Re: [v9.2] DROP statement reworks

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Kohei KaiGai <kaigai(at)kaigai(dot)gr(dot)jp>
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:46:38
Message-ID: CA+Tgmob53G0OWgtxUy-jdB4NV-TepMfXD5k13RajCd0ME7wQnw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Kohei KaiGai 2011-10-12 12:53:32 Re: [v9.2] DROP statement reworks
Previous Message Florian Pflug 2011-10-12 12:44:29 Re: Overhead cost of Serializable Snapshot Isolation