Re: BUG #14317: psql \dt not working as expected

From: John R Pierce <pierce(at)hogranch(dot)com>
To: lucian(dot)ciufudean(at)gmail(dot)com, pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #14317: psql \dt not working as expected
Date: 2016-09-08 15:46:42
Message-ID: c3f3e43b-c84d-2c53-dfb5-1e9974831e1b@hogranch.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On 9/8/2016 8:40 AM, lucian(dot)ciufudean(at)gmail(dot)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

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2016-09-08 15:52:57 Re: BUG #14317: psql \dt not working as expected
Previous Message lucian.ciufudean 2016-09-08 15:40:03 BUG #14317: psql \dt not working as expected