Re: FWD: Re: Updated backslash consistency patch

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Gregory Stark <stark(at)enterprisedb(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Robert Haas <robertmhaas(at)gmail(dot)com>, Brendan Jurd <direvus(at)gmail(dot)com>, Greg Sabino Mullane <greg(at)turnstep(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: FWD: Re: Updated backslash consistency patch
Date: 2009-01-20 02:13:48
Message-ID: 200901200213.n0K2Dms23221@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Gregory Stark wrote:
> The behaviour of \dt in the face of tables which shadow system tables is
> actually even stranger:
>
> postgres=# create table pg_proc (t text);
> CREATE TABLE
> postgres=# commit;
> COMMIT
> postgres=# \dt pg_proc
> No matching relations found.
>
>
> And I don't see any reason aggregates, operators, etc, shouldn't be any more
> susceptible the shadowing problem.

The inconsistency between \d and \dt is not defensible, and no one said
they liked it. Here is an example:

test=> \d pg_language
--> Table "pg_catalog.pg_language"
Column | Type | Modifiers
---------------+-----------+-----------
lanname | name | not null
lanowner | oid | not null
lanispl | boolean | not null
lanpltrusted | boolean | not null
lanplcallfoid | oid | not null
lanvalidator | oid | not null
lanacl | aclitem[] |
Indexes:
"pg_language_name_index" UNIQUE, btree (lanname)
"pg_language_oid_index" UNIQUE, btree (oid)

test=> \dt pg_language
--> No matching relations found.

As you can see, \d shows system tables, while \dt does not. The
attached patch makes \d and \dt consistent:

test=> \d pg_language
Did not find any relation named "pg_language".

test=> \dt pg_language
No matching relations found.

test=> \dS pg_language
Table "pg_catalog.pg_language"
Column | Type | Modifiers
---------------+-----------+-----------
lanname | name | not null
lanowner | oid | not null
lanispl | boolean | not null
lanpltrusted | boolean | not null
lanplcallfoid | oid | not null
lanvalidator | oid | not null
lanacl | aclitem[] |
Indexes:
"pg_language_name_index" UNIQUE, btree (lanname)
"pg_language_oid_index" UNIQUE, btree (oid)

test=> \dtS pg_language
List of relations
Schema | Name | Type | Owner
------------+-------------+-------+----------
pg_catalog | pg_language | table | postgres
(1 row)

In pre-8.4, 'S' was recognised only by \dt.

The other part of the patch shows system and _user_ tables when \dtS is
used, to be consistent with the rest of the \d* commands.

I know we don't like the current behavior, but I think we need to make
them consistent first for easy testing and so when we change it, it will
remain consistent.

Applied. I will work on a consensus patch soon for the new behavior.

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +

Attachment Content-Type Size
/pgpatches/psql-d text/x-diff 4.9 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Hiroshi Inoue 2009-01-20 03:31:29 Re: Re: [COMMITTERS] pgsql: Explicitly bind gettext() to the UTF8 locale when in use.
Previous Message Bruce Momjian 2009-01-19 22:55:55 Re: Statement-level triggers and inheritance