Re: \dt doesn't show all relations in user's schemas (8.4.2)

From: Scott Marlowe <scott(dot)marlowe(at)gmail(dot)com>
To: Adrian Klaver <aklaver(at)comcast(dot)net>
Cc: Filip Rembiałkowski <plk(dot)zuber(at)gmail(dot)com>, pgsql-general(at)postgresql(dot)org, Ralph Graulich <ralph(dot)graulich(at)t-online(dot)de>
Subject: Re: \dt doesn't show all relations in user's schemas (8.4.2)
Date: 2009-12-21 22:12:45
Message-ID: dcc563d10912211412x3033693cr5b5e76f0b32f6252@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, Dec 21, 2009 at 3:06 PM, Adrian Klaver <aklaver(at)comcast(dot)net> wrote:
>
>
>
> ----- "Scott Marlowe" <scott(dot)marlowe(at)gmail(dot)com> wrote:
>
>> 2009/12/21 Adrian Klaver <aklaver(at)comcast(dot)net>:
>> >
>> >
>> >
>> > ----- "Filip Rembiałkowski" <plk(dot)zuber(at)gmail(dot)com> wrote:
>> >> 2009/12/19 Ralph Graulich < ralph(dot)graulich(at)t-online(dot)de >
>> >>
>> >>
>> >>
>> >>
>> >> -- Only one of the two relations is shown
>> >>
>> >>
>> >>
>> >>
>> >> I would call it a bug. Reproduced here, on 8.4.2 and 8.3.8
>> >>
>> >>
>> >>
>> >>
>> >
>> > Try \dt *.table1
>>
>> While that should work, suppose you have three schemas with the same
>> table, and your search path is set to look at two.  \dt by itself
>> should only show the two in your search path, so it's not equivalent,
>> but it is handy...
>
> Interested in a definitive answer to this as I understood that the below held and that in order to see identical names in more than one schema you needed to schema qualify the names or use wildcards.
>
> http://www.postgresql.org/docs/8.4/static/runtime-config-client.html
> When there are objects of identical names in different schemas, the one found first in the search path is used

So, there are two parts of the docs that don't really agree with each
other completely. While this behaviour seems natural and expected
when running select, update, insert, alter and so on, it seems to be
somewhat iffy in the case of \dt. I'm not sure which is the right
behaviour. I'd lean towards listing the two tables with the same name
in different schemas with schema.tablename notation for each one so
you know which is which. I'm guessing that /dt is using search_path
and takes the first one only right now.

So, either the docs for \dt need fixing to reflect reality, or they're
right and psql \dt needs fixing.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Dimitri Fontaine 2009-12-21 23:24:46 Re: Extracting SQL from logs in a usable format
Previous Message Adrian Klaver 2009-12-21 22:06:25 Re: \dt doesn't show all relations in user's schemas (8.4.2)