behavior of \dt and schemas

From: John Scalia <jayknowsunix(at)gmail(dot)com>
To: "pgsql-admin(at)postgresql(dot)org" <pgsql-admin(at)postgresql(dot)org>
Subject: behavior of \dt and schemas
Date: 2017-01-20 14:53:04
Message-ID: CABzCKRAoMHjwr__4Y6tEmF8HAm2yZhEgPVqwg8=Y8_1-cfDjsg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Hi all,

I've come across some rather non-intuitive behavior with \dt output. Say I
have schema A and schema B, both with an identical mytable in them. If I
set the search_path to A; and type \dt, I see

List of relations
Schema | Name | Type | Owner
-------------------------------------------------------
a | mytable | table | postgres

So far so good, and I get a similar output If I just set the search_path to
B, only now it properly shows the schema as b. However, if I set the
search_path to a, b; and enter \dt, I only see the tables from the first
schema "a", like the above. and not the second schema. I would have
expected:

List of relations
Schema | Name | Type | Owner
-------------------------------------------------------
a | mytable | table | postgres
b | mytable | table | postgres

So, to me this is somewhat non-intuitive behavior, but maybe I'm all wet
here. Shouldn't \dt report all the tables it can see with the search_path
set to some value? And btw, this is was the behavior on 9.4.10, so if it's
changed in more recent versions, I haven't tested there yet.

Flame suit on,
Jay

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Stephen Frost 2017-01-20 15:11:26 Re: behavior of \dt and schemas
Previous Message Adrian Klaver 2017-01-19 14:51:00 Re: Moving from 9.5 to 9.6