Re: behavior of \dt and schemas

From: John Scalia <jayknowsunix(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>, "pgsql-admin(at)postgresql(dot)org" <pgsql-admin(at)postgresql(dot)org>
Subject: Re: behavior of \dt and schemas
Date: 2017-01-20 16:09:31
Message-ID: CABzCKRDXfOhhwq+FFnUeXed0Z9OeWj+YgMfa05iFTxfMTg_0QA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Understood, but I would have suspected that the search_path value would
have been expanded to report all the tables visible under each schema, and
not mask any. It just surprised me a little.

On Fri, Jan 20, 2017 at 10:37 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

> "David G. Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> writes:
> > On Friday, January 20, 2017, John Scalia <jayknowsunix(at)gmail(dot)com> wrote:
> >> 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.
>
> > It shows the definition of the table you would be referencing if you used
> > that name in a query. This seems like a useful behavior.
>
> Right --- according to our normal terminology, b.mytable is *not* visible,
> because it is masked by a.mytable being ahead of it in the search path.
> You'd have to write a qualified name to get at b.mytable.
>
> You can write, eg, "\dt *.mytable" or "\dt *.*" if you would like it to
> show tables that are not visible according to this rule. Without a
> dot in the pattern, \dt shows only visible tables, ie only the ones
> you could name without putting a dot in the name.
>
> regards, tom lane
>

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message John Scalia 2017-01-20 16:18:07 Re: behavior of \dt and schemas
Previous Message Tom Lane 2017-01-20 15:37:35 Re: behavior of \dt and schemas