Re: BUG #14317: psql \dt not working as expected - Mailing list pgsql-bugs

From John R Pierce
Subject Re: BUG #14317: psql \dt not working as expected
Date
Msg-id c3f3e43b-c84d-2c53-dfb5-1e9974831e1b@hogranch.com
Whole thread Raw
In response to BUG #14317: psql \dt not working as expected  (lucian.ciufudean@gmail.com)
List pgsql-bugs
On 9/8/2016 8:40 AM, lucian.ciufudean@gmail.com wrote:
> If one creates a table with the same name as one of the pg_catalog tables
>
> 1. CREATE TABLE pg_tables (
>      name            varchar(80),
>      location        point
> );
>
> then \dt will not show it:
>
>           List of relations
>   Schema |  Name  | Type  |  Owner
> --------+--------+-------+----------
>   public | cities | table | postgres
> (1 row)
>
> while this query will:
>
> select * from pg_tables;
>
> Expectations: \dt shows all tables in the public schema.
>
> Note that it is also unexpected that this query:
>
> select * from pg_tables;
>
> goes to pg_catalog.pg_tables instead of public.pg_tables.

this is because pg_catalog is implicitly in the search path in front of
any explicit search path you specify, including the default of
`$user,public` ...

suggestion:  don't use names like pg_XXXXX for anything.


--
john r pierce, recycling bits in santa cruz

pgsql-bugs by date:

Previous
From: lucian.ciufudean@gmail.com
Date:
Subject: BUG #14317: psql \dt not working as expected
Next
From: Tom Lane
Date:
Subject: Re: BUG #14317: psql \dt not working as expected