Re: Another quick question... - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Another quick question...
Date
Msg-id 4375.1028175993@sss.pgh.pa.us
Whole thread Raw
In response to Another quick question...  ("Christopher Kings-Lynne" <chriskl@familyhealth.com.au>)
Responses Re: Another quick question...
List pgsql-hackers
"Christopher Kings-Lynne" <chriskl@familyhealth.com.au> writes:
> If you have RelationGetRelationName(rel) to get the name of a relation, how
> do you get it's fully qualified schema name?  Or how do I get the schema
> name for the relation?

Well, you can do get_namespace_name(rel->rd_rel->relnamespace), but
I don't really agree with changing error messages to *always* quote
the schema name.  I think that'd be overly verbose.  An appropriate
solution is to mention the schema name only when it's necessary to
identify the relation (ie, the rel would not be found in your current
search path).

generate_relation_name() in backend/utils/adt/ruleutils.c illustrates
how to do this.  Maybe that code ought to be promoted into some more
widely useful location.  See also the recently added format_procedure()
and format_operator() in regproc.c.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Curt Sampson
Date:
Subject: Re: Rules and Views
Next
From: Tom Lane
Date:
Subject: Re: Rules and Views