"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