On Sat, Jun 18, 2011 at 1:43 PM, Josh Kupershmidt <schmiddy@gmail.com> wrote:
>> Regarding to the data-type of objnamespace, how about an idea to define a new
>> data type such as 'regschema' and cast objnamespace into this type?
>> If we have such data type, user can reference string expression of schema name,
>> and also available to use OID joins.
>
> Are you suggesting we leave the structure of pg_comments unchanged,
> but introduce a new 'regschema' type so that if users want to easily
> display the schema name of an object, they can just do:
>
> SELECT objnamespace::regschema, ...
> FROM pg_comments WHERE ... ;
>
> That seems reasonable to me.
In the past I think the feeling has been that reg* types are primarily
useful for objects with schema-qualified names. Translating a table
OID into a table name is actually sort of non-trivial, at least if you
want to schema-qualify its name when and only when necessary. The use
case seems quite a bit weaker for schemas, since you can easily pull
the right value from pg_namespace with a subquery if you are so
inclined.
It is perhaps worth noting that the patch now under discussion on this
thread does something quite a lot different than what the subject
would suggest.
--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company