1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-31 22:04:40 +03:00

psql: Split up "Modifiers" column in \d and \dD

Make separate columns "Collation", "Nullable", "Default".

Reviewed-by: Kuntal Ghosh <kuntalghosh.2007@gmail.com>
This commit is contained in:
Peter Eisentraut
2016-11-03 12:00:00 -04:00
parent 1d15d0db50
commit a0f357e570
28 changed files with 1144 additions and 1176 deletions

View File

@ -1049,10 +1049,10 @@ HINT: Use DROP ... CASCADE to drop the dependent objects too.
drop extension cube cascade;
NOTICE: drop cascades to table foo column f1
\d foo
Table "public.foo"
Column | Type | Modifiers
--------+---------+-----------
f2 | integer |
Table "public.foo"
Column | Type | Collation | Nullable | Default
--------+---------+-----------+----------+---------
f2 | integer | | |
-- list what's installed
\dT public.*

View File

@ -6707,43 +6707,43 @@ IMPORT FOREIGN SCHEMA import_source FROM SERVER loopback INTO import_dest1;
(5 rows)
\d import_dest1.*
Foreign table "import_dest1.t1"
Column | Type | Modifiers | FDW Options
--------+-------------------+-----------+--------------------
c1 | integer | | (column_name 'c1')
c2 | character varying | not null | (column_name 'c2')
Foreign table "import_dest1.t1"
Column | Type | Collation | Nullable | Default | FDW Options
--------+-------------------+-----------+----------+---------+--------------------
c1 | integer | | | | (column_name 'c1')
c2 | character varying | | not null | | (column_name 'c2')
Server: loopback
FDW Options: (schema_name 'import_source', table_name 't1')
Foreign table "import_dest1.t2"
Column | Type | Modifiers | FDW Options
--------+-------------------+---------------+--------------------
c1 | integer | | (column_name 'c1')
c2 | character varying | | (column_name 'c2')
c3 | text | collate POSIX | (column_name 'c3')
Foreign table "import_dest1.t2"
Column | Type | Collation | Nullable | Default | FDW Options
--------+-------------------+-----------+----------+---------+--------------------
c1 | integer | | | | (column_name 'c1')
c2 | character varying | | | | (column_name 'c2')
c3 | text | POSIX | | | (column_name 'c3')
Server: loopback
FDW Options: (schema_name 'import_source', table_name 't2')
Foreign table "import_dest1.t3"
Column | Type | Modifiers | FDW Options
--------+--------------------------+-----------+--------------------
c1 | timestamp with time zone | | (column_name 'c1')
c2 | typ1 | | (column_name 'c2')
Foreign table "import_dest1.t3"
Column | Type | Collation | Nullable | Default | FDW Options
--------+--------------------------+-----------+----------+---------+--------------------
c1 | timestamp with time zone | | | | (column_name 'c1')
c2 | typ1 | | | | (column_name 'c2')
Server: loopback
FDW Options: (schema_name 'import_source', table_name 't3')
Foreign table "import_dest1.x 4"
Column | Type | Modifiers | FDW Options
--------+-----------------------+-----------+---------------------
c1 | double precision | | (column_name 'c1')
C 2 | text | | (column_name 'C 2')
c3 | character varying(42) | | (column_name 'c3')
Foreign table "import_dest1.x 4"
Column | Type | Collation | Nullable | Default | FDW Options
--------+-----------------------+-----------+----------+---------+---------------------
c1 | double precision | | | | (column_name 'c1')
C 2 | text | | | | (column_name 'C 2')
c3 | character varying(42) | | | | (column_name 'c3')
Server: loopback
FDW Options: (schema_name 'import_source', table_name 'x 4')
Foreign table "import_dest1.x 5"
Column | Type | Modifiers | FDW Options
--------+------+-----------+-------------
Foreign table "import_dest1.x 5"
Column | Type | Collation | Nullable | Default | FDW Options
--------+------+-----------+----------+---------+-------------
Server: loopback
FDW Options: (schema_name 'import_source', table_name 'x 5')
@ -6763,43 +6763,43 @@ IMPORT FOREIGN SCHEMA import_source FROM SERVER loopback INTO import_dest2
(5 rows)
\d import_dest2.*
Foreign table "import_dest2.t1"
Column | Type | Modifiers | FDW Options
--------+-------------------+-----------+--------------------
c1 | integer | | (column_name 'c1')
c2 | character varying | not null | (column_name 'c2')
Foreign table "import_dest2.t1"
Column | Type | Collation | Nullable | Default | FDW Options
--------+-------------------+-----------+----------+---------+--------------------
c1 | integer | | | | (column_name 'c1')
c2 | character varying | | not null | | (column_name 'c2')
Server: loopback
FDW Options: (schema_name 'import_source', table_name 't1')
Foreign table "import_dest2.t2"
Column | Type | Modifiers | FDW Options
--------+-------------------+---------------+--------------------
c1 | integer | default 42 | (column_name 'c1')
c2 | character varying | | (column_name 'c2')
c3 | text | collate POSIX | (column_name 'c3')
Foreign table "import_dest2.t2"
Column | Type | Collation | Nullable | Default | FDW Options
--------+-------------------+-----------+----------+---------+--------------------
c1 | integer | | | 42 | (column_name 'c1')
c2 | character varying | | | | (column_name 'c2')
c3 | text | POSIX | | | (column_name 'c3')
Server: loopback
FDW Options: (schema_name 'import_source', table_name 't2')
Foreign table "import_dest2.t3"
Column | Type | Modifiers | FDW Options
--------+--------------------------+---------------+--------------------
c1 | timestamp with time zone | default now() | (column_name 'c1')
c2 | typ1 | | (column_name 'c2')
Foreign table "import_dest2.t3"
Column | Type | Collation | Nullable | Default | FDW Options
--------+--------------------------+-----------+----------+---------+--------------------
c1 | timestamp with time zone | | | now() | (column_name 'c1')
c2 | typ1 | | | | (column_name 'c2')
Server: loopback
FDW Options: (schema_name 'import_source', table_name 't3')
Foreign table "import_dest2.x 4"
Column | Type | Modifiers | FDW Options
--------+-----------------------+-----------+---------------------
c1 | double precision | | (column_name 'c1')
C 2 | text | | (column_name 'C 2')
c3 | character varying(42) | | (column_name 'c3')
Foreign table "import_dest2.x 4"
Column | Type | Collation | Nullable | Default | FDW Options
--------+-----------------------+-----------+----------+---------+---------------------
c1 | double precision | | | | (column_name 'c1')
C 2 | text | | | | (column_name 'C 2')
c3 | character varying(42) | | | | (column_name 'c3')
Server: loopback
FDW Options: (schema_name 'import_source', table_name 'x 4')
Foreign table "import_dest2.x 5"
Column | Type | Modifiers | FDW Options
--------+------+-----------+-------------
Foreign table "import_dest2.x 5"
Column | Type | Collation | Nullable | Default | FDW Options
--------+------+-----------+----------+---------+-------------
Server: loopback
FDW Options: (schema_name 'import_source', table_name 'x 5')
@ -6818,43 +6818,43 @@ IMPORT FOREIGN SCHEMA import_source FROM SERVER loopback INTO import_dest3
(5 rows)
\d import_dest3.*
Foreign table "import_dest3.t1"
Column | Type | Modifiers | FDW Options
--------+-------------------+-----------+--------------------
c1 | integer | | (column_name 'c1')
c2 | character varying | | (column_name 'c2')
Foreign table "import_dest3.t1"
Column | Type | Collation | Nullable | Default | FDW Options
--------+-------------------+-----------+----------+---------+--------------------
c1 | integer | | | | (column_name 'c1')
c2 | character varying | | | | (column_name 'c2')
Server: loopback
FDW Options: (schema_name 'import_source', table_name 't1')
Foreign table "import_dest3.t2"
Column | Type | Modifiers | FDW Options
--------+-------------------+-----------+--------------------
c1 | integer | | (column_name 'c1')
c2 | character varying | | (column_name 'c2')
c3 | text | | (column_name 'c3')
Foreign table "import_dest3.t2"
Column | Type | Collation | Nullable | Default | FDW Options
--------+-------------------+-----------+----------+---------+--------------------
c1 | integer | | | | (column_name 'c1')
c2 | character varying | | | | (column_name 'c2')
c3 | text | | | | (column_name 'c3')
Server: loopback
FDW Options: (schema_name 'import_source', table_name 't2')
Foreign table "import_dest3.t3"
Column | Type | Modifiers | FDW Options
--------+--------------------------+-----------+--------------------
c1 | timestamp with time zone | | (column_name 'c1')
c2 | typ1 | | (column_name 'c2')
Foreign table "import_dest3.t3"
Column | Type | Collation | Nullable | Default | FDW Options
--------+--------------------------+-----------+----------+---------+--------------------
c1 | timestamp with time zone | | | | (column_name 'c1')
c2 | typ1 | | | | (column_name 'c2')
Server: loopback
FDW Options: (schema_name 'import_source', table_name 't3')
Foreign table "import_dest3.x 4"
Column | Type | Modifiers | FDW Options
--------+-----------------------+-----------+---------------------
c1 | double precision | | (column_name 'c1')
C 2 | text | | (column_name 'C 2')
c3 | character varying(42) | | (column_name 'c3')
Foreign table "import_dest3.x 4"
Column | Type | Collation | Nullable | Default | FDW Options
--------+-----------------------+-----------+----------+---------+---------------------
c1 | double precision | | | | (column_name 'c1')
C 2 | text | | | | (column_name 'C 2')
c3 | character varying(42) | | | | (column_name 'c3')
Server: loopback
FDW Options: (schema_name 'import_source', table_name 'x 4')
Foreign table "import_dest3.x 5"
Column | Type | Modifiers | FDW Options
--------+------+-----------+-------------
Foreign table "import_dest3.x 5"
Column | Type | Collation | Nullable | Default | FDW Options
--------+------+-----------+----------+---------+-------------
Server: loopback
FDW Options: (schema_name 'import_source', table_name 'x 5')

View File

@ -416,12 +416,12 @@ CREATE TABLE replication_metadata (
WITH (user_catalog_table = true)
;
\d+ replication_metadata
Table "public.replication_metadata"
Column | Type | Modifiers | Storage | Stats target | Description
----------+---------+-------------------------------------------------------------------+----------+--------------+-------------
id | integer | not null default nextval('replication_metadata_id_seq'::regclass) | plain | |
relation | name | not null | plain | |
options | text[] | | extended | |
Table "public.replication_metadata"
Column | Type | Collation | Nullable | Default | Storage | Stats target | Description
----------+---------+-----------+----------+--------------------------------------------------+----------+--------------+-------------
id | integer | | not null | nextval('replication_metadata_id_seq'::regclass) | plain | |
relation | name | | not null | | plain | |
options | text[] | | | | extended | |
Indexes:
"replication_metadata_pkey" PRIMARY KEY, btree (id)
Options: user_catalog_table=true
@ -430,12 +430,12 @@ INSERT INTO replication_metadata(relation, options)
VALUES ('foo', ARRAY['a', 'b']);
ALTER TABLE replication_metadata RESET (user_catalog_table);
\d+ replication_metadata
Table "public.replication_metadata"
Column | Type | Modifiers | Storage | Stats target | Description
----------+---------+-------------------------------------------------------------------+----------+--------------+-------------
id | integer | not null default nextval('replication_metadata_id_seq'::regclass) | plain | |
relation | name | not null | plain | |
options | text[] | | extended | |
Table "public.replication_metadata"
Column | Type | Collation | Nullable | Default | Storage | Stats target | Description
----------+---------+-----------+----------+--------------------------------------------------+----------+--------------+-------------
id | integer | | not null | nextval('replication_metadata_id_seq'::regclass) | plain | |
relation | name | | not null | | plain | |
options | text[] | | | | extended | |
Indexes:
"replication_metadata_pkey" PRIMARY KEY, btree (id)
@ -443,12 +443,12 @@ INSERT INTO replication_metadata(relation, options)
VALUES ('bar', ARRAY['a', 'b']);
ALTER TABLE replication_metadata SET (user_catalog_table = true);
\d+ replication_metadata
Table "public.replication_metadata"
Column | Type | Modifiers | Storage | Stats target | Description
----------+---------+-------------------------------------------------------------------+----------+--------------+-------------
id | integer | not null default nextval('replication_metadata_id_seq'::regclass) | plain | |
relation | name | not null | plain | |
options | text[] | | extended | |
Table "public.replication_metadata"
Column | Type | Collation | Nullable | Default | Storage | Stats target | Description
----------+---------+-----------+----------+--------------------------------------------------+----------+--------------+-------------
id | integer | | not null | nextval('replication_metadata_id_seq'::regclass) | plain | |
relation | name | | not null | | plain | |
options | text[] | | | | extended | |
Indexes:
"replication_metadata_pkey" PRIMARY KEY, btree (id)
Options: user_catalog_table=true
@ -461,13 +461,13 @@ ALTER TABLE replication_metadata ALTER COLUMN rewritemeornot TYPE text;
ERROR: cannot rewrite table "replication_metadata" used as a catalog table
ALTER TABLE replication_metadata SET (user_catalog_table = false);
\d+ replication_metadata
Table "public.replication_metadata"
Column | Type | Modifiers | Storage | Stats target | Description
----------------+---------+-------------------------------------------------------------------+----------+--------------+-------------
id | integer | not null default nextval('replication_metadata_id_seq'::regclass) | plain | |
relation | name | not null | plain | |
options | text[] | | extended | |
rewritemeornot | integer | | plain | |
Table "public.replication_metadata"
Column | Type | Collation | Nullable | Default | Storage | Stats target | Description
----------------+---------+-----------+----------+--------------------------------------------------+----------+--------------+-------------
id | integer | | not null | nextval('replication_metadata_id_seq'::regclass) | plain | |
relation | name | | not null | | plain | |
options | text[] | | | | extended | |
rewritemeornot | integer | | | | plain | |
Indexes:
"replication_metadata_pkey" PRIMARY KEY, btree (id)
Options: user_catalog_table=false