psql \dt and identical table names across multiple schemas

From: "Murat Tasan" <murat(dot)tasan(dot)cwru(dot)edu(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: psql \dt and identical table names across multiple schemas
Date: 2008-07-25 03:49:35
Message-ID: 32f5c0fc0807242049g7afb7d62xc8afebdca5089c8f@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

This may have been brought up before, but if not, I thought I would bring it
to attention, as I think this would be an easy fix.
The problem: 2 (or more) schemas that have an identical table name.
>From within psql, the \dt (and variants of it) will only show a single
version of that table.

example input:

CREATE SCHEMA schema1;
CREATE TABLE schema1.tableX (id integer);
CREATE TABLE schema1.tableY (id integer);
CREATE SCHEMA schema2;
CREATE TABLE schema2.tableX (id integer);
CREATE TABLE schema2.tableZ (id integer);
set search_path to schema1, schema2;
\dt

example output from \dt command:

schema1 | tablex | table | username
schema1 | tabley | table | username
schema2 | tablez | table | username

It seems to me, that if the schemas are even listed in the output of the \dt
command, all identically-named tables should be listed.
In fact, showing the schema name but not showing all the tables becomes
non-intuitive and somewhat misleading.

Thoughts?

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Chris 2008-07-25 04:06:39 Re: php + postgresql
Previous Message Scott Marlowe 2008-07-25 03:23:52 Re: FK check will use index on referring table?