2011/10/12 Robert Haas <robertmhaas@gmail.com>:
> On Wed, Oct 12, 2011 at 8:07 AM, Kohei KaiGai <kaigai@kaigai.gr.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@kaigai.gr.jp>