Re: BUG #14578: Tables with same name in different schema are not shown with \dt

From: Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>
To: francois(at)teksol(dot)info
Cc: PostgreSQL Bugs List <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: BUG #14578: Tables with same name in different schema are not shown with \dt
Date: 2017-03-04 15:20:58
Message-ID: alpine.DEB.2.20.1703041604150.30598@lancre
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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.

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message François Beausoleil 2017-03-04 16:33:17 Re: BUG #14578: Tables with same name in different schema are not shown with \dt
Previous Message Tom Lane 2017-03-04 15:17:44 Re: BUG #14578: Tables with same name in different schema are not shown with \dt