Thread: psql \d command hides objects from "lower" schemas
Version and Operating System:
PostgreSQL 9.2.2 on i686-pc-linux-gnu, compiled by gcc (GCC) 4.7.2, 32-bitPostgreSQL 9.2.2, compiled by Visual C++ build 1600, 32-bit
Description of Bug:
I attached a file input.sql which contains a few commands necessary for bug report. In summary:
create schema front, back;
set search_path to front,back,public;
create table back.some_table (...);
create view front.some_table ...;
create table {public,back,front}.another (...);
\d
Given this, when using the psql command \d, I expect to see all the tables, and the view as well as the table. But instead the objects in the front-most schema mask the other objects.
I'm submitting this as a bug, because it seems to be one. If this behavior is intended, please forgive me! (And if it is intended, is there flag to make objects in higher schemas not mask other objects?)
Steps to reproduce bug:
$ createdb -U postgres -O benmorgan bugreport
$ psql bugreport < bugreport-input.sql
$ psql bugreport
psql (9.2.2)
Type "help" for help.
bugreport=>\d
List of relations
Schema | Name | Type | Owner
--------+-------------------+----------+-----------
back | some_table_id_seq | sequence | benmorgan
front | another | table | benmorgan
front | another_id_seq | sequence | benmorgan
front | some_table | view | benmorgan
(4 rows)
Thanks!
-Ben
Attachment
On Wed, Jan 23, 2013 at 6:21 AM, Ben Morgan <neembi@gmail.com> wrote: > Given this, when using the psql command \d, I expect to see all the table= s, > and the view as well as the table. But instead the objects in the front-m= ost > schema mask the other objects. > > I'm submitting this as a bug, because it seems to be one. If this behavio= r > is intended, please forgive me! (And if it is intended, is there flag to > make objects in higher schemas not mask other objects?) I think the relevant section of the docs: http://www.postgresql.org/docs/current/static/app-psql.html is the paragraph beginning: | Whenever the pattern parameter is omitted completely, the \d commands | display all objects that are visible in the current schema search | path =97 this is equivalent to using * as the pattern. Note, I believe that explanation is a bit lacking, i.e a plain. \d is quite different from \d * both in the format of the output, and that the latter displays pg_catalog tables. At any rate, you can use: \dtv *.* for all tables and views in all schemas. (Unfortunately, you are then stuck with noise from pg_catalog and information_schema.) Josh
On Wed, Jan 23, 2013 at 5:11 PM, Josh Kupershmidt <schmiddy@gmail.com>wrote: > Note, I believe that explanation is a bit lacking, i.e a plain. > \d > is quite different from > \d * > both in the format of the output, and that the latter displays > pg_catalog tables. At any rate, you can use: > \dtv *.* > for all tables and views in all schemas. (Unfortunately, you are then > stuck with noise from pg_catalog and information_schema.) Thanks for the clarification! (Truly sorry for the spam, you guys are great!) Ben