Re: BUG #1803: Incomplete table list in psql

From: Michael Fuhr <mike(at)fuhr(dot)org>
To: DKnoto <dknoto(at)wiml(dot)waw(dot)pl>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #1803: Incomplete table list in psql
Date: 2005-08-05 13:53:43
Message-ID: 20050805135343.GA97765@winnie.fuhr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Wed, Aug 03, 2005 at 10:29:38AM +0100, DKnoto wrote:
> I have database with two schemas: S1 and S2. In each schema exist table T1
> but psql show only table in first schema listet in SEARCH_PATH.

Is this what you mean?

CREATE SCHEMA s1;
CREATE TABLE s1.t1 (x integer);

CREATE SCHEMA s2;
CREATE TABLE s2.t1 (y integer);
CREATE TABLE s2.t2 (z integer);

SET search_path TO s1, s2;

\dt
List of relations
Schema | Name | Type | Owner
--------+------+-------+-------
s1 | t1 | table | mfuhr
s2 | t2 | table | mfuhr
(2 rows)

Note what the psql documentation says about the \d command and an
object's visibility:

A pattern that contains an (unquoted) dot is interpreted as a schema
name pattern followed by an object name pattern. For example, \dt
foo*.bar* displays all tables in schemas whose name starts with foo
and whose table name starts with bar. If no dot appears, then the
pattern matches only objects that are visible in the current schema
search path.

Whenever the pattern parameter is omitted completely, the \d
commands display all objects that are visible in the current schema
search path. To see all objects in the database, use the pattern *.*.

psql uses pg_table_is_visible() to determine tables' visibility,
and the documentation for that function says:

A table is said to be visible if its containing schema is in the
search path and no table of the same name appears earlier in the
search path. This is equivalent to the statement that the table can
be referenced by name without explicit schema qualification.

--
Michael Fuhr

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Michael Afanasiev 2005-08-05 14:25:30 BUG #1808: bug: plan bugs on alert /drop table
Previous Message Michael Fuhr 2005-08-05 13:08:12 Re: a bug in libpq, PSQL 8.0.3