Re: [BUGS] BUG #14578: Tables with same name in different schemaare not shown with \dt - Mailing list pgsql-bugs

From Fabien COELHO
Subject Re: [BUGS] BUG #14578: Tables with same name in different schemaare not shown with \dt
Date
Msg-id alpine.DEB.2.20.1703041604150.30598@lancre
Whole thread Raw
In response to [BUGS] BUG #14578: Tables with same name in different schema are not shownwith \dt  (francois@teksol.info)
List pgsql-bugs
Hello François,

> name. PG supports that no problem, but when I listed the tables using \dt
> and the search path set to both schemas, I expected to see the two tables.

From the source code this this is a somehow debatable but voluntary 
feature. The query explicitely checks whether the table is visible:

   ... AND pg_catalog.pg_table_is_visible(c.oid)

That is whether it is ahead in the path, so the second one is masked, as 
doc says:

"""
Whenever the pattern parameter is omitted completely, the \d commands 
display all objects that are visible in the current schema search path — 
this is equivalent to using * as the pattern. (An object is said to be 
visible if its containing schema is in the search path and no object of 
the same kind and name appears earlier in the search path. This is 
equivalent to the statement that the object can be referenced by name 
without explicit schema qualification.) To see all objects in the database 
regardless of visibility, use *.* as the pattern.
"""

Now ISTM that "psql" documentation could be clearer: the explanation is 
hidden within the "pattern" description...

Note that the visibility filtering cannot be removed easily, because then 
the ordering (currently schema/name) would have to be fixed as well, and 
people would be surprised somehow by the resulting display...

-- 
Fabien.
-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: [BUGS] BUG #14578: Tables with same name in different schema are not shown with \dt
Next
From: François Beausoleil
Date:
Subject: Re: [BUGS] BUG #14578: Tables with same name in different schema are not shown with \dt