[prev in list] [next in list] [prev in thread] [next in thread] 

List:       postgresql-general
Subject:    Re: [HACKERS] [RFC] Common object property boards
From:       Kohei KaiGai <kaigai () kaigai ! gr ! jp>
Date:       2011-07-31 6:21:55
Message-ID: CADyhKSXGSLj9-C-J+stLLparShs3ZJASJmBTQendzz=dFmqurA () mail ! gmail ! com
[Download RAW message or body]

2011/7/29 Tom Lane <tgl@sss.pgh.pa.us>:
> Kohei Kaigai <Kohei.Kaigai@EMEA.NEC.COM> writes:
>> In addition to this suggestion, I think the big static array also contains
>> the following items:
>> - Text form of the object type (e.g, "table", "function", ...)
>
> What will you do with that that wouldn't be better done by calling
> getObjectDescription?  The latter's output is somewhat localizable, but
> individual words would be hard to translate.
>
The getObjectDescription() is good for existing object, but we cannot use
this interface to generate error messages of not exist object.

>> Does the main lookup function ought to return an entry of the big array?
>> If so, the definition of structure should be declared in objectaddress.h,
>> as follows:
>
> It would likely be better to not expose the struct type, just individual
> lookup functions.
>
If so, individual functions to expose a certain property of the supplied
object type should be provided.

  int get_object_property_catid_oidlookup(ObjectType);
  int get_object_property_catid_namelookup(ObjectType);
  Oid get_object_property_relation_id(ObjectType);
  AttrNumber get_object_property_nameattnum(ObjectType);
  AttrNumber get_object_property_namespacenum(ObjectType);
  AttrNumber get_object_property_ownershipnum(ObjectType);

I'm not a fun to invoke these functions more than once in a certain step.
For example, AlterObjectNamespace() wants to know attribute number
of name, namespace and ownership. In addition, it also want cache-id
of oid-loopup and name-lookup. Thus, it takes 5 times invocation of
these function, rather than one lookup for array.

Which is more preferable for programmer?

>> And, a translation from ObjectType to type name (e.g "table", "type", ...)
>> is helpful to generate error messages.
>
>>   const char *get_object_type_name(ObjectType objtype);
>
> Again, I think this is too low level because of message translation
> considerations.
>
OK.

Thanks,
-- 
KaiGai Kohei <kaigai@kaigai.gr.jp>

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic