"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