psql \d for wide tables / pattern for individual columns

Поиск
Список
Период
Сортировка
От Justin Pryzby
Тема psql \d for wide tables / pattern for individual columns
Дата
Msg-id 20191110212928.GQ4999@telsasoft.com
обсуждение исходный текст
Ответы Re: psql \d for wide tables / pattern for individual columns  (Euler Taveira <euler@timbira.com.br>)
Список pgsql-hackers
We have some very wide tables (historically, up to 1600 columns ; this is
improved now, but sometimes still several hundred, with numerous pages output
to psql pager).  Is is reasonable to suggest adding a psql command to show a
table's definition, without all the columns listed?

Or limit display to matching columns ?  That's more general than the above
functionality, if "empty string" is taken to mean "show no columns", like \d
table "" or \d table *id or \d table ????

Attached minimal patch for the latter.

postgres=# \d pg_attribute ""
        Table "pg_catalog.pg_attribute"
 Column | Type | Collation | Nullable | Default 
--------+------+-----------+----------+---------
Indexes:
    "pg_attribute_relid_attnam_index" UNIQUE, btree (attrelid, attname)
    "pg_attribute_relid_attnum_index" UNIQUE, btree (attrelid, attnum)

postgres=# \d pg_attribute "attn*|attrel*"
            Table "pg_catalog.pg_attribute"
   Column   |   Type   | Collation | Nullable | Default 
------------+----------+-----------+----------+---------
 attrelid   | oid      |           | not null | 
 attname    | name     |           | not null | 
 attnum     | smallint |           | not null | 
 attndims   | integer  |           | not null | 
 attnotnull | boolean  |           | not null | 
Indexes:
    "pg_attribute_relid_attnam_index" UNIQUE, btree (attrelid, attname)
    "pg_attribute_relid_attnum_index" UNIQUE, btree (attrelid, attnum)

postgres=# \d pg_attribute ??????
           Table "pg_catalog.pg_attribute"
 Column |   Type    | Collation | Nullable | Default 
--------+-----------+-----------+----------+---------
 attlen | smallint  |           | not null | 
 attnum | smallint  |           | not null | 
 attacl | aclitem[] |           |          | 
Indexes:
    "pg_attribute_relid_attnam_index" UNIQUE, btree (attrelid, attname)
    "pg_attribute_relid_attnum_index" UNIQUE, btree (attrelid, attnum)

postgres=# \d pg_attribute *id
         Table "pg_catalog.pg_attribute"
  Column  | Type | Collation | Nullable | Default 
----------+------+-----------+----------+---------
 attrelid | oid  |           | not null | 
 atttypid | oid  |           | not null | 
Indexes:
    "pg_attribute_relid_attnam_index" UNIQUE, btree (attrelid, attname)
    "pg_attribute_relid_attnum_index" UNIQUE, btree (attrelid, attnum)

Вложения

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Tomas Vondra
Дата:
Сообщение: Re: Index Skip Scan
Следующее
От: Daniel Gustafsson
Дата:
Сообщение: Re: pg_upgrade fails to detect unsupported arrays and ranges