Re: Wanted: RelationIsVisible interface - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Wanted: RelationIsVisible interface
Date
Msg-id 20811.1028954117@sss.pgh.pa.us
Whole thread Raw
In response to Wanted: RelationIsVisible interface  ("Greg Sabino Mullane" <greg@turnstep.com>)
List pgsql-hackers
"Greg Sabino Mullane" <greg@turnstep.com> writes:
>> we'd write something like
>> select ... from pg_class p, ... 
>> where relname like 'foo%' and pg_relation_is_visible(p.oid) and ...

> I see what you are saying, and this is fine for those cases in which the user
> has supplied the schema, but I don't see how it solves the ordering problem. 
> If I have a table public.foo and greg.foo, and both are "visible", how will 
> psql know which one to show?

By definition, only one can be visible: a table named "foo" hides any
other "foo" that's later in the search path.  This is exactly the point
that the is_visible tests cover, while there isn't any easy way to
handle it in SQL by comparison of a relnamespace value to a
current_schemas list --- that comparison doesn't tell you anything
about possible conflicting names elsewhere in the search path.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: [COMMITTERS] pgsql-server/src backend/tcop/postgres.cbacke
Next
From: Tom Lane
Date:
Subject: Re: Proposal for psql wildcarding behavior w/schemas