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:
parent
1d15d0db50
commit
a0f357e570
contrib
earthdistance/expected
postgres_fdw/expected
test_decoding/expected
doc/src/sgml/ref
src
bin/psql
interfaces/ecpg/test
test/regress/expected
@ -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.*
|
||||
|
@ -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')
|
||||
|
||||
|
@ -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
|
||||
|
@ -459,9 +459,9 @@ CREATE [ UNIQUE ] INDEX [ CONCURRENTLY ] [ [ IF NOT EXISTS ] <replaceable class=
|
||||
<programlisting>
|
||||
postgres=# \d tab
|
||||
Table "public.tab"
|
||||
Column | Type | Modifiers
|
||||
--------+---------+-----------
|
||||
col | integer |
|
||||
Column | Type | Collation | Nullable | Default
|
||||
--------+---------+-----------+----------+---------
|
||||
col | integer | | |
|
||||
Indexes:
|
||||
"idx" btree (col) INVALID
|
||||
</programlisting>
|
||||
|
@ -4081,12 +4081,11 @@ CREATE TABLE
|
||||
Now look at the table definition again:
|
||||
<programlisting>
|
||||
testdb=> <userinput>\d my_table</userinput>
|
||||
Table "my_table"
|
||||
Attribute | Type | Modifier
|
||||
-----------+---------+--------------------
|
||||
first | integer | not null default 0
|
||||
second | text |
|
||||
|
||||
Table "public.my_table"
|
||||
Column | Type | Collation | Nullable | Default
|
||||
--------+---------+-----------+----------+---------
|
||||
first | integer | | not null | 0
|
||||
second | text | | |
|
||||
</programlisting>
|
||||
Now we change the prompt to something more interesting:
|
||||
<programlisting>
|
||||
|
@ -1322,9 +1322,8 @@ describeOneTableDetails(const char *schemaname,
|
||||
bool printTableInitialized = false;
|
||||
int i;
|
||||
char *view_def = NULL;
|
||||
char *headers[9];
|
||||
char *headers[11];
|
||||
char **seq_values = NULL;
|
||||
char **modifiers = NULL;
|
||||
char **ptr;
|
||||
PQExpBufferData title;
|
||||
PQExpBufferData tmpbuf;
|
||||
@ -1346,7 +1345,7 @@ describeOneTableDetails(const char *schemaname,
|
||||
char relpersistence;
|
||||
char relreplident;
|
||||
} tableinfo;
|
||||
bool show_modifiers = false;
|
||||
bool show_column_details = false;
|
||||
bool retval;
|
||||
|
||||
retval = false;
|
||||
@ -1649,9 +1648,10 @@ describeOneTableDetails(const char *schemaname,
|
||||
tableinfo.relkind == 'm' ||
|
||||
tableinfo.relkind == 'f' || tableinfo.relkind == 'c')
|
||||
{
|
||||
show_modifiers = true;
|
||||
headers[cols++] = gettext_noop("Modifiers");
|
||||
modifiers = pg_malloc0((numrows + 1) * sizeof(*modifiers));
|
||||
headers[cols++] = gettext_noop("Collation");
|
||||
headers[cols++] = gettext_noop("Nullable");
|
||||
headers[cols++] = gettext_noop("Default");
|
||||
show_column_details = true;
|
||||
}
|
||||
|
||||
if (tableinfo.relkind == 'S')
|
||||
@ -1709,39 +1709,15 @@ describeOneTableDetails(const char *schemaname,
|
||||
/* Type */
|
||||
printTableAddCell(&cont, PQgetvalue(res, i, 1), false, false);
|
||||
|
||||
/* Modifiers: collate, not null, default */
|
||||
if (show_modifiers)
|
||||
/* Collation, Nullable, Default */
|
||||
if (show_column_details)
|
||||
{
|
||||
resetPQExpBuffer(&tmpbuf);
|
||||
printTableAddCell(&cont, PQgetvalue(res, i, 5), false, false);
|
||||
|
||||
if (!PQgetisnull(res, i, 5))
|
||||
{
|
||||
if (tmpbuf.len > 0)
|
||||
appendPQExpBufferChar(&tmpbuf, ' ');
|
||||
appendPQExpBuffer(&tmpbuf, _("collate %s"),
|
||||
PQgetvalue(res, i, 5));
|
||||
}
|
||||
printTableAddCell(&cont, strcmp(PQgetvalue(res, i, 3), "t") == 0 ? "not null" : "", false, false);
|
||||
|
||||
if (strcmp(PQgetvalue(res, i, 3), "t") == 0)
|
||||
{
|
||||
if (tmpbuf.len > 0)
|
||||
appendPQExpBufferChar(&tmpbuf, ' ');
|
||||
appendPQExpBufferStr(&tmpbuf, _("not null"));
|
||||
}
|
||||
|
||||
/* handle "default" here */
|
||||
/* (note: above we cut off the 'default' string at 128) */
|
||||
if (strlen(PQgetvalue(res, i, 2)) != 0)
|
||||
{
|
||||
if (tmpbuf.len > 0)
|
||||
appendPQExpBufferChar(&tmpbuf, ' ');
|
||||
/* translator: default values of column definitions */
|
||||
appendPQExpBuffer(&tmpbuf, _("default %s"),
|
||||
PQgetvalue(res, i, 2));
|
||||
}
|
||||
|
||||
modifiers[i] = pg_strdup(tmpbuf.data);
|
||||
printTableAddCell(&cont, modifiers[i], false, false);
|
||||
printTableAddCell(&cont, PQgetvalue(res, i, 2), false, false);
|
||||
}
|
||||
|
||||
/* Value: for sequences only */
|
||||
@ -2670,13 +2646,6 @@ error_return:
|
||||
free(seq_values);
|
||||
}
|
||||
|
||||
if (modifiers)
|
||||
{
|
||||
for (ptr = modifiers; *ptr; ptr++)
|
||||
free(*ptr);
|
||||
free(modifiers);
|
||||
}
|
||||
|
||||
if (view_def)
|
||||
free(view_def);
|
||||
|
||||
@ -3235,24 +3204,24 @@ listDomains(const char *pattern, bool verbose, bool showSystem)
|
||||
printfPQExpBuffer(&buf,
|
||||
"SELECT n.nspname as \"%s\",\n"
|
||||
" t.typname as \"%s\",\n"
|
||||
" pg_catalog.format_type(t.typbasetype, t.typtypmod) as \"%s\",\n"
|
||||
" TRIM(LEADING\n",
|
||||
" pg_catalog.format_type(t.typbasetype, t.typtypmod) as \"%s\",\n",
|
||||
gettext_noop("Schema"),
|
||||
gettext_noop("Name"),
|
||||
gettext_noop("Type"));
|
||||
|
||||
if (pset.sversion >= 90100)
|
||||
appendPQExpBufferStr(&buf,
|
||||
" COALESCE((SELECT ' collate ' || c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type bt\n"
|
||||
" WHERE c.oid = t.typcollation AND bt.oid = t.typbasetype AND t.typcollation <> bt.typcollation), '') ||\n");
|
||||
appendPQExpBuffer(&buf,
|
||||
" (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type bt\n"
|
||||
" WHERE c.oid = t.typcollation AND bt.oid = t.typbasetype AND t.typcollation <> bt.typcollation) as \"%s\",\n",
|
||||
gettext_noop("Collation"));
|
||||
appendPQExpBuffer(&buf,
|
||||
" CASE WHEN t.typnotnull THEN ' not null' ELSE '' END ||\n"
|
||||
" CASE WHEN t.typdefault IS NOT NULL THEN ' default ' || t.typdefault ELSE '' END\n"
|
||||
" ) as \"%s\",\n"
|
||||
" CASE WHEN t.typnotnull THEN 'not null' END as \"%s\",\n"
|
||||
" t.typdefault as \"%s\",\n"
|
||||
" pg_catalog.array_to_string(ARRAY(\n"
|
||||
" SELECT pg_catalog.pg_get_constraintdef(r.oid, true) FROM pg_catalog.pg_constraint r WHERE t.oid = r.contypid\n"
|
||||
" ), ' ') as \"%s\"",
|
||||
gettext_noop("Modifier"),
|
||||
gettext_noop("Nullable"),
|
||||
gettext_noop("Default"),
|
||||
gettext_noop("Check"));
|
||||
|
||||
if (verbose)
|
||||
|
@ -113,8 +113,8 @@ int main(void)
|
||||
|
||||
/*
|
||||
Table "public.history"
|
||||
Column | Type | Modifiers
|
||||
--------------+-----------------------------+-----------
|
||||
Column | Type | Nullable
|
||||
--------------+-----------------------------+----------
|
||||
customerid | integer | not null
|
||||
timestamp | timestamp without time zone | not null
|
||||
action_taken | character(5) | not null
|
||||
|
@ -281,8 +281,8 @@ if (sqlca.sqlcode < 0) sqlprint();}
|
||||
|
||||
/*
|
||||
Table "public.history"
|
||||
Column | Type | Modifiers
|
||||
--------------+-----------------------------+-----------
|
||||
Column | Type | Nullable
|
||||
--------------+-----------------------------+----------
|
||||
customerid | integer | not null
|
||||
timestamp | timestamp without time zone | not null
|
||||
action_taken | character(5) | not null
|
||||
|
@ -180,12 +180,12 @@ ALTER TABLE onek DROP CONSTRAINT onek_unique1_constraint_foo;
|
||||
-- renaming constraints vs. inheritance
|
||||
CREATE TABLE constraint_rename_test (a int CONSTRAINT con1 CHECK (a > 0), b int, c int);
|
||||
\d constraint_rename_test
|
||||
Table "public.constraint_rename_test"
|
||||
Column | Type | Modifiers
|
||||
--------+---------+-----------
|
||||
a | integer |
|
||||
b | integer |
|
||||
c | integer |
|
||||
Table "public.constraint_rename_test"
|
||||
Column | Type | Collation | Nullable | Default
|
||||
--------+---------+-----------+----------+---------
|
||||
a | integer | | |
|
||||
b | integer | | |
|
||||
c | integer | | |
|
||||
Check constraints:
|
||||
"con1" CHECK (a > 0)
|
||||
|
||||
@ -193,13 +193,13 @@ CREATE TABLE constraint_rename_test2 (a int CONSTRAINT con1 CHECK (a > 0), d int
|
||||
NOTICE: merging column "a" with inherited definition
|
||||
NOTICE: merging constraint "con1" with inherited definition
|
||||
\d constraint_rename_test2
|
||||
Table "public.constraint_rename_test2"
|
||||
Column | Type | Modifiers
|
||||
--------+---------+-----------
|
||||
a | integer |
|
||||
b | integer |
|
||||
c | integer |
|
||||
d | integer |
|
||||
Table "public.constraint_rename_test2"
|
||||
Column | Type | Collation | Nullable | Default
|
||||
--------+---------+-----------+----------+---------
|
||||
a | integer | | |
|
||||
b | integer | | |
|
||||
c | integer | | |
|
||||
d | integer | | |
|
||||
Check constraints:
|
||||
"con1" CHECK (a > 0)
|
||||
Inherits: constraint_rename_test
|
||||
@ -210,24 +210,24 @@ ALTER TABLE ONLY constraint_rename_test RENAME CONSTRAINT con1 TO con1foo; -- fa
|
||||
ERROR: inherited constraint "con1" must be renamed in child tables too
|
||||
ALTER TABLE constraint_rename_test RENAME CONSTRAINT con1 TO con1foo; -- ok
|
||||
\d constraint_rename_test
|
||||
Table "public.constraint_rename_test"
|
||||
Column | Type | Modifiers
|
||||
--------+---------+-----------
|
||||
a | integer |
|
||||
b | integer |
|
||||
c | integer |
|
||||
Table "public.constraint_rename_test"
|
||||
Column | Type | Collation | Nullable | Default
|
||||
--------+---------+-----------+----------+---------
|
||||
a | integer | | |
|
||||
b | integer | | |
|
||||
c | integer | | |
|
||||
Check constraints:
|
||||
"con1foo" CHECK (a > 0)
|
||||
Number of child tables: 1 (Use \d+ to list them.)
|
||||
|
||||
\d constraint_rename_test2
|
||||
Table "public.constraint_rename_test2"
|
||||
Column | Type | Modifiers
|
||||
--------+---------+-----------
|
||||
a | integer |
|
||||
b | integer |
|
||||
c | integer |
|
||||
d | integer |
|
||||
Table "public.constraint_rename_test2"
|
||||
Column | Type | Collation | Nullable | Default
|
||||
--------+---------+-----------+----------+---------
|
||||
a | integer | | |
|
||||
b | integer | | |
|
||||
c | integer | | |
|
||||
d | integer | | |
|
||||
Check constraints:
|
||||
"con1foo" CHECK (a > 0)
|
||||
Inherits: constraint_rename_test
|
||||
@ -236,25 +236,25 @@ ALTER TABLE constraint_rename_test ADD CONSTRAINT con2 CHECK (b > 0) NO INHERIT;
|
||||
ALTER TABLE ONLY constraint_rename_test RENAME CONSTRAINT con2 TO con2foo; -- ok
|
||||
ALTER TABLE constraint_rename_test RENAME CONSTRAINT con2foo TO con2bar; -- ok
|
||||
\d constraint_rename_test
|
||||
Table "public.constraint_rename_test"
|
||||
Column | Type | Modifiers
|
||||
--------+---------+-----------
|
||||
a | integer |
|
||||
b | integer |
|
||||
c | integer |
|
||||
Table "public.constraint_rename_test"
|
||||
Column | Type | Collation | Nullable | Default
|
||||
--------+---------+-----------+----------+---------
|
||||
a | integer | | |
|
||||
b | integer | | |
|
||||
c | integer | | |
|
||||
Check constraints:
|
||||
"con1foo" CHECK (a > 0)
|
||||
"con2bar" CHECK (b > 0) NO INHERIT
|
||||
Number of child tables: 1 (Use \d+ to list them.)
|
||||
|
||||
\d constraint_rename_test2
|
||||
Table "public.constraint_rename_test2"
|
||||
Column | Type | Modifiers
|
||||
--------+---------+-----------
|
||||
a | integer |
|
||||
b | integer |
|
||||
c | integer |
|
||||
d | integer |
|
||||
Table "public.constraint_rename_test2"
|
||||
Column | Type | Collation | Nullable | Default
|
||||
--------+---------+-----------+----------+---------
|
||||
a | integer | | |
|
||||
b | integer | | |
|
||||
c | integer | | |
|
||||
d | integer | | |
|
||||
Check constraints:
|
||||
"con1foo" CHECK (a > 0)
|
||||
Inherits: constraint_rename_test
|
||||
@ -262,12 +262,12 @@ Inherits: constraint_rename_test
|
||||
ALTER TABLE constraint_rename_test ADD CONSTRAINT con3 PRIMARY KEY (a);
|
||||
ALTER TABLE constraint_rename_test RENAME CONSTRAINT con3 TO con3foo; -- ok
|
||||
\d constraint_rename_test
|
||||
Table "public.constraint_rename_test"
|
||||
Column | Type | Modifiers
|
||||
--------+---------+-----------
|
||||
a | integer | not null
|
||||
b | integer |
|
||||
c | integer |
|
||||
Table "public.constraint_rename_test"
|
||||
Column | Type | Collation | Nullable | Default
|
||||
--------+---------+-----------+----------+---------
|
||||
a | integer | | not null |
|
||||
b | integer | | |
|
||||
c | integer | | |
|
||||
Indexes:
|
||||
"con3foo" PRIMARY KEY, btree (a)
|
||||
Check constraints:
|
||||
@ -276,13 +276,13 @@ Check constraints:
|
||||
Number of child tables: 1 (Use \d+ to list them.)
|
||||
|
||||
\d constraint_rename_test2
|
||||
Table "public.constraint_rename_test2"
|
||||
Column | Type | Modifiers
|
||||
--------+---------+-----------
|
||||
a | integer |
|
||||
b | integer |
|
||||
c | integer |
|
||||
d | integer |
|
||||
Table "public.constraint_rename_test2"
|
||||
Column | Type | Collation | Nullable | Default
|
||||
--------+---------+-----------+----------+---------
|
||||
a | integer | | |
|
||||
b | integer | | |
|
||||
c | integer | | |
|
||||
d | integer | | |
|
||||
Check constraints:
|
||||
"con1foo" CHECK (a > 0)
|
||||
Inherits: constraint_rename_test
|
||||
@ -383,10 +383,10 @@ set constraint_exclusion TO 'partition';
|
||||
create table nv_parent (d date, check (false) no inherit not valid);
|
||||
-- not valid constraint added at creation time should automatically become valid
|
||||
\d nv_parent
|
||||
Table "public.nv_parent"
|
||||
Column | Type | Modifiers
|
||||
--------+------+-----------
|
||||
d | date |
|
||||
Table "public.nv_parent"
|
||||
Column | Type | Collation | Nullable | Default
|
||||
--------+------+-----------+----------+---------
|
||||
d | date | | |
|
||||
Check constraints:
|
||||
"nv_parent_check" CHECK (false) NO INHERIT
|
||||
|
||||
@ -450,10 +450,10 @@ explain (costs off) select * from nv_parent where d between '2009-08-01'::date a
|
||||
-- add an inherited NOT VALID constraint
|
||||
alter table nv_parent add check (d between '2001-01-01'::date and '2099-12-31'::date) not valid;
|
||||
\d nv_child_2009
|
||||
Table "public.nv_child_2009"
|
||||
Column | Type | Modifiers
|
||||
--------+------+-----------
|
||||
d | date |
|
||||
Table "public.nv_child_2009"
|
||||
Column | Type | Collation | Nullable | Default
|
||||
--------+------+-----------+----------+---------
|
||||
d | date | | |
|
||||
Check constraints:
|
||||
"nv_child_2009_d_check" CHECK (d >= '01-01-2009'::date AND d <= '12-31-2009'::date)
|
||||
"nv_parent_d_check" CHECK (d >= '01-01-2001'::date AND d <= '12-31-2099'::date) NOT VALID
|
||||
@ -1904,21 +1904,21 @@ where oid = 'test_storage'::regclass;
|
||||
CREATE TABLE test_inh_check (a float check (a > 10.2), b float);
|
||||
CREATE TABLE test_inh_check_child() INHERITS(test_inh_check);
|
||||
\d test_inh_check
|
||||
Table "public.test_inh_check"
|
||||
Column | Type | Modifiers
|
||||
--------+------------------+-----------
|
||||
a | double precision |
|
||||
b | double precision |
|
||||
Table "public.test_inh_check"
|
||||
Column | Type | Collation | Nullable | Default
|
||||
--------+------------------+-----------+----------+---------
|
||||
a | double precision | | |
|
||||
b | double precision | | |
|
||||
Check constraints:
|
||||
"test_inh_check_a_check" CHECK (a > 10.2::double precision)
|
||||
Number of child tables: 1 (Use \d+ to list them.)
|
||||
|
||||
\d test_inh_check_child
|
||||
Table "public.test_inh_check_child"
|
||||
Column | Type | Modifiers
|
||||
--------+------------------+-----------
|
||||
a | double precision |
|
||||
b | double precision |
|
||||
Table "public.test_inh_check_child"
|
||||
Column | Type | Collation | Nullable | Default
|
||||
--------+------------------+-----------+----------+---------
|
||||
a | double precision | | |
|
||||
b | double precision | | |
|
||||
Check constraints:
|
||||
"test_inh_check_a_check" CHECK (a > 10.2::double precision)
|
||||
Inherits: test_inh_check
|
||||
@ -1935,21 +1935,21 @@ select relname, conname, coninhcount, conislocal, connoinherit
|
||||
|
||||
ALTER TABLE test_inh_check ALTER COLUMN a TYPE numeric;
|
||||
\d test_inh_check
|
||||
Table "public.test_inh_check"
|
||||
Column | Type | Modifiers
|
||||
--------+------------------+-----------
|
||||
a | numeric |
|
||||
b | double precision |
|
||||
Table "public.test_inh_check"
|
||||
Column | Type | Collation | Nullable | Default
|
||||
--------+------------------+-----------+----------+---------
|
||||
a | numeric | | |
|
||||
b | double precision | | |
|
||||
Check constraints:
|
||||
"test_inh_check_a_check" CHECK (a::double precision > 10.2::double precision)
|
||||
Number of child tables: 1 (Use \d+ to list them.)
|
||||
|
||||
\d test_inh_check_child
|
||||
Table "public.test_inh_check_child"
|
||||
Column | Type | Modifiers
|
||||
--------+------------------+-----------
|
||||
a | numeric |
|
||||
b | double precision |
|
||||
Table "public.test_inh_check_child"
|
||||
Column | Type | Collation | Nullable | Default
|
||||
--------+------------------+-----------+----------+---------
|
||||
a | numeric | | |
|
||||
b | double precision | | |
|
||||
Check constraints:
|
||||
"test_inh_check_a_check" CHECK (a::double precision > 10.2::double precision)
|
||||
Inherits: test_inh_check
|
||||
@ -1971,11 +1971,11 @@ ALTER TABLE test_inh_check_child ADD CONSTRAINT bmerged CHECK (b > 1);
|
||||
ALTER TABLE test_inh_check ADD CONSTRAINT bmerged CHECK (b > 1);
|
||||
NOTICE: merging constraint "bmerged" with inherited definition
|
||||
\d test_inh_check
|
||||
Table "public.test_inh_check"
|
||||
Column | Type | Modifiers
|
||||
--------+------------------+-----------
|
||||
a | numeric |
|
||||
b | double precision |
|
||||
Table "public.test_inh_check"
|
||||
Column | Type | Collation | Nullable | Default
|
||||
--------+------------------+-----------+----------+---------
|
||||
a | numeric | | |
|
||||
b | double precision | | |
|
||||
Check constraints:
|
||||
"bmerged" CHECK (b > 1::double precision)
|
||||
"bnoinherit" CHECK (b > 100::double precision) NO INHERIT
|
||||
@ -1983,11 +1983,11 @@ Check constraints:
|
||||
Number of child tables: 1 (Use \d+ to list them.)
|
||||
|
||||
\d test_inh_check_child
|
||||
Table "public.test_inh_check_child"
|
||||
Column | Type | Modifiers
|
||||
--------+------------------+-----------
|
||||
a | numeric |
|
||||
b | double precision |
|
||||
Table "public.test_inh_check_child"
|
||||
Column | Type | Collation | Nullable | Default
|
||||
--------+------------------+-----------+----------+---------
|
||||
a | numeric | | |
|
||||
b | double precision | | |
|
||||
Check constraints:
|
||||
"blocal" CHECK (b < 1000::double precision)
|
||||
"bmerged" CHECK (b > 1::double precision)
|
||||
@ -2011,11 +2011,11 @@ select relname, conname, coninhcount, conislocal, connoinherit
|
||||
ALTER TABLE test_inh_check ALTER COLUMN b TYPE numeric;
|
||||
NOTICE: merging constraint "bmerged" with inherited definition
|
||||
\d test_inh_check
|
||||
Table "public.test_inh_check"
|
||||
Column | Type | Modifiers
|
||||
--------+---------+-----------
|
||||
a | numeric |
|
||||
b | numeric |
|
||||
Table "public.test_inh_check"
|
||||
Column | Type | Collation | Nullable | Default
|
||||
--------+---------+-----------+----------+---------
|
||||
a | numeric | | |
|
||||
b | numeric | | |
|
||||
Check constraints:
|
||||
"bmerged" CHECK (b::double precision > 1::double precision)
|
||||
"bnoinherit" CHECK (b::double precision > 100::double precision) NO INHERIT
|
||||
@ -2023,11 +2023,11 @@ Check constraints:
|
||||
Number of child tables: 1 (Use \d+ to list them.)
|
||||
|
||||
\d test_inh_check_child
|
||||
Table "public.test_inh_check_child"
|
||||
Column | Type | Modifiers
|
||||
--------+---------+-----------
|
||||
a | numeric |
|
||||
b | numeric |
|
||||
Table "public.test_inh_check_child"
|
||||
Column | Type | Collation | Nullable | Default
|
||||
--------+---------+-----------+----------+---------
|
||||
a | numeric | | |
|
||||
b | numeric | | |
|
||||
Check constraints:
|
||||
"blocal" CHECK (b::double precision < 1000::double precision)
|
||||
"bmerged" CHECK (b::double precision > 1::double precision)
|
||||
@ -2056,11 +2056,11 @@ ALTER TABLE check_fk_presence_2 DROP CONSTRAINT check_fk_presence_2_id_fkey;
|
||||
ANALYZE check_fk_presence_2;
|
||||
ROLLBACK;
|
||||
\d check_fk_presence_2
|
||||
Table "public.check_fk_presence_2"
|
||||
Column | Type | Modifiers
|
||||
--------+---------+-----------
|
||||
id | integer |
|
||||
t | text |
|
||||
Table "public.check_fk_presence_2"
|
||||
Column | Type | Collation | Nullable | Default
|
||||
--------+---------+-----------+----------+---------
|
||||
id | integer | | |
|
||||
t | text | | |
|
||||
Foreign-key constraints:
|
||||
"check_fk_presence_2_id_fkey" FOREIGN KEY (id) REFERENCES check_fk_presence_1(id)
|
||||
|
||||
@ -2414,45 +2414,45 @@ drop cascades to text search dictionary dict
|
||||
--
|
||||
CREATE TYPE test_type AS (a int);
|
||||
\d test_type
|
||||
Composite type "public.test_type"
|
||||
Column | Type | Modifiers
|
||||
--------+---------+-----------
|
||||
a | integer |
|
||||
Composite type "public.test_type"
|
||||
Column | Type | Collation | Nullable | Default
|
||||
--------+---------+-----------+----------+---------
|
||||
a | integer | | |
|
||||
|
||||
ALTER TYPE nosuchtype ADD ATTRIBUTE b text; -- fails
|
||||
ERROR: relation "nosuchtype" does not exist
|
||||
ALTER TYPE test_type ADD ATTRIBUTE b text;
|
||||
\d test_type
|
||||
Composite type "public.test_type"
|
||||
Column | Type | Modifiers
|
||||
--------+---------+-----------
|
||||
a | integer |
|
||||
b | text |
|
||||
Composite type "public.test_type"
|
||||
Column | Type | Collation | Nullable | Default
|
||||
--------+---------+-----------+----------+---------
|
||||
a | integer | | |
|
||||
b | text | | |
|
||||
|
||||
ALTER TYPE test_type ADD ATTRIBUTE b text; -- fails
|
||||
ERROR: column "b" of relation "test_type" already exists
|
||||
ALTER TYPE test_type ALTER ATTRIBUTE b SET DATA TYPE varchar;
|
||||
\d test_type
|
||||
Composite type "public.test_type"
|
||||
Column | Type | Modifiers
|
||||
--------+-------------------+-----------
|
||||
a | integer |
|
||||
b | character varying |
|
||||
Composite type "public.test_type"
|
||||
Column | Type | Collation | Nullable | Default
|
||||
--------+-------------------+-----------+----------+---------
|
||||
a | integer | | |
|
||||
b | character varying | | |
|
||||
|
||||
ALTER TYPE test_type ALTER ATTRIBUTE b SET DATA TYPE integer;
|
||||
\d test_type
|
||||
Composite type "public.test_type"
|
||||
Column | Type | Modifiers
|
||||
--------+---------+-----------
|
||||
a | integer |
|
||||
b | integer |
|
||||
Composite type "public.test_type"
|
||||
Column | Type | Collation | Nullable | Default
|
||||
--------+---------+-----------+----------+---------
|
||||
a | integer | | |
|
||||
b | integer | | |
|
||||
|
||||
ALTER TYPE test_type DROP ATTRIBUTE b;
|
||||
\d test_type
|
||||
Composite type "public.test_type"
|
||||
Column | Type | Modifiers
|
||||
--------+---------+-----------
|
||||
a | integer |
|
||||
Composite type "public.test_type"
|
||||
Column | Type | Collation | Nullable | Default
|
||||
--------+---------+-----------+----------+---------
|
||||
a | integer | | |
|
||||
|
||||
ALTER TYPE test_type DROP ATTRIBUTE c; -- fails
|
||||
ERROR: column "c" of relation "test_type" does not exist
|
||||
@ -2460,19 +2460,19 @@ ALTER TYPE test_type DROP ATTRIBUTE IF EXISTS c;
|
||||
NOTICE: column "c" of relation "test_type" does not exist, skipping
|
||||
ALTER TYPE test_type DROP ATTRIBUTE a, ADD ATTRIBUTE d boolean;
|
||||
\d test_type
|
||||
Composite type "public.test_type"
|
||||
Column | Type | Modifiers
|
||||
--------+---------+-----------
|
||||
d | boolean |
|
||||
Composite type "public.test_type"
|
||||
Column | Type | Collation | Nullable | Default
|
||||
--------+---------+-----------+----------+---------
|
||||
d | boolean | | |
|
||||
|
||||
ALTER TYPE test_type RENAME ATTRIBUTE a TO aa;
|
||||
ERROR: column "a" does not exist
|
||||
ALTER TYPE test_type RENAME ATTRIBUTE d TO dd;
|
||||
\d test_type
|
||||
Composite type "public.test_type"
|
||||
Column | Type | Modifiers
|
||||
--------+---------+-----------
|
||||
dd | boolean |
|
||||
Composite type "public.test_type"
|
||||
Column | Type | Collation | Nullable | Default
|
||||
--------+---------+-----------+----------+---------
|
||||
dd | boolean | | |
|
||||
|
||||
DROP TYPE test_type;
|
||||
CREATE TYPE test_type1 AS (a int, b text);
|
||||
@ -2483,18 +2483,18 @@ CREATE TYPE test_type2 AS (a int, b text);
|
||||
CREATE TABLE test_tbl2 OF test_type2;
|
||||
CREATE TABLE test_tbl2_subclass () INHERITS (test_tbl2);
|
||||
\d test_type2
|
||||
Composite type "public.test_type2"
|
||||
Column | Type | Modifiers
|
||||
--------+---------+-----------
|
||||
a | integer |
|
||||
b | text |
|
||||
Composite type "public.test_type2"
|
||||
Column | Type | Collation | Nullable | Default
|
||||
--------+---------+-----------+----------+---------
|
||||
a | integer | | |
|
||||
b | text | | |
|
||||
|
||||
\d test_tbl2
|
||||
Table "public.test_tbl2"
|
||||
Column | Type | Modifiers
|
||||
--------+---------+-----------
|
||||
a | integer |
|
||||
b | text |
|
||||
Table "public.test_tbl2"
|
||||
Column | Type | Collation | Nullable | Default
|
||||
--------+---------+-----------+----------+---------
|
||||
a | integer | | |
|
||||
b | text | | |
|
||||
Number of child tables: 1 (Use \d+ to list them.)
|
||||
Typed table of type: test_type2
|
||||
|
||||
@ -2503,20 +2503,20 @@ ERROR: cannot alter type "test_type2" because it is the type of a typed table
|
||||
HINT: Use ALTER ... CASCADE to alter the typed tables too.
|
||||
ALTER TYPE test_type2 ADD ATTRIBUTE c text CASCADE;
|
||||
\d test_type2
|
||||
Composite type "public.test_type2"
|
||||
Column | Type | Modifiers
|
||||
--------+---------+-----------
|
||||
a | integer |
|
||||
b | text |
|
||||
c | text |
|
||||
Composite type "public.test_type2"
|
||||
Column | Type | Collation | Nullable | Default
|
||||
--------+---------+-----------+----------+---------
|
||||
a | integer | | |
|
||||
b | text | | |
|
||||
c | text | | |
|
||||
|
||||
\d test_tbl2
|
||||
Table "public.test_tbl2"
|
||||
Column | Type | Modifiers
|
||||
--------+---------+-----------
|
||||
a | integer |
|
||||
b | text |
|
||||
c | text |
|
||||
Table "public.test_tbl2"
|
||||
Column | Type | Collation | Nullable | Default
|
||||
--------+---------+-----------+----------+---------
|
||||
a | integer | | |
|
||||
b | text | | |
|
||||
c | text | | |
|
||||
Number of child tables: 1 (Use \d+ to list them.)
|
||||
Typed table of type: test_type2
|
||||
|
||||
@ -2525,20 +2525,20 @@ ERROR: cannot alter type "test_type2" because it is the type of a typed table
|
||||
HINT: Use ALTER ... CASCADE to alter the typed tables too.
|
||||
ALTER TYPE test_type2 ALTER ATTRIBUTE b TYPE varchar CASCADE;
|
||||
\d test_type2
|
||||
Composite type "public.test_type2"
|
||||
Column | Type | Modifiers
|
||||
--------+-------------------+-----------
|
||||
a | integer |
|
||||
b | character varying |
|
||||
c | text |
|
||||
Composite type "public.test_type2"
|
||||
Column | Type | Collation | Nullable | Default
|
||||
--------+-------------------+-----------+----------+---------
|
||||
a | integer | | |
|
||||
b | character varying | | |
|
||||
c | text | | |
|
||||
|
||||
\d test_tbl2
|
||||
Table "public.test_tbl2"
|
||||
Column | Type | Modifiers
|
||||
--------+-------------------+-----------
|
||||
a | integer |
|
||||
b | character varying |
|
||||
c | text |
|
||||
Table "public.test_tbl2"
|
||||
Column | Type | Collation | Nullable | Default
|
||||
--------+-------------------+-----------+----------+---------
|
||||
a | integer | | |
|
||||
b | character varying | | |
|
||||
c | text | | |
|
||||
Number of child tables: 1 (Use \d+ to list them.)
|
||||
Typed table of type: test_type2
|
||||
|
||||
@ -2547,18 +2547,18 @@ ERROR: cannot alter type "test_type2" because it is the type of a typed table
|
||||
HINT: Use ALTER ... CASCADE to alter the typed tables too.
|
||||
ALTER TYPE test_type2 DROP ATTRIBUTE b CASCADE;
|
||||
\d test_type2
|
||||
Composite type "public.test_type2"
|
||||
Column | Type | Modifiers
|
||||
--------+---------+-----------
|
||||
a | integer |
|
||||
c | text |
|
||||
Composite type "public.test_type2"
|
||||
Column | Type | Collation | Nullable | Default
|
||||
--------+---------+-----------+----------+---------
|
||||
a | integer | | |
|
||||
c | text | | |
|
||||
|
||||
\d test_tbl2
|
||||
Table "public.test_tbl2"
|
||||
Column | Type | Modifiers
|
||||
--------+---------+-----------
|
||||
a | integer |
|
||||
c | text |
|
||||
Table "public.test_tbl2"
|
||||
Column | Type | Collation | Nullable | Default
|
||||
--------+---------+-----------+----------+---------
|
||||
a | integer | | |
|
||||
c | text | | |
|
||||
Number of child tables: 1 (Use \d+ to list them.)
|
||||
Typed table of type: test_type2
|
||||
|
||||
@ -2567,27 +2567,27 @@ ERROR: cannot alter type "test_type2" because it is the type of a typed table
|
||||
HINT: Use ALTER ... CASCADE to alter the typed tables too.
|
||||
ALTER TYPE test_type2 RENAME ATTRIBUTE a TO aa CASCADE;
|
||||
\d test_type2
|
||||
Composite type "public.test_type2"
|
||||
Column | Type | Modifiers
|
||||
--------+---------+-----------
|
||||
aa | integer |
|
||||
c | text |
|
||||
Composite type "public.test_type2"
|
||||
Column | Type | Collation | Nullable | Default
|
||||
--------+---------+-----------+----------+---------
|
||||
aa | integer | | |
|
||||
c | text | | |
|
||||
|
||||
\d test_tbl2
|
||||
Table "public.test_tbl2"
|
||||
Column | Type | Modifiers
|
||||
--------+---------+-----------
|
||||
aa | integer |
|
||||
c | text |
|
||||
Table "public.test_tbl2"
|
||||
Column | Type | Collation | Nullable | Default
|
||||
--------+---------+-----------+----------+---------
|
||||
aa | integer | | |
|
||||
c | text | | |
|
||||
Number of child tables: 1 (Use \d+ to list them.)
|
||||
Typed table of type: test_type2
|
||||
|
||||
\d test_tbl2_subclass
|
||||
Table "public.test_tbl2_subclass"
|
||||
Column | Type | Modifiers
|
||||
--------+---------+-----------
|
||||
aa | integer |
|
||||
c | text |
|
||||
Table "public.test_tbl2_subclass"
|
||||
Column | Type | Collation | Nullable | Default
|
||||
--------+---------+-----------+----------+---------
|
||||
aa | integer | | |
|
||||
c | text | | |
|
||||
Inherits: test_tbl2
|
||||
|
||||
DROP TABLE test_tbl2_subclass;
|
||||
@ -2631,11 +2631,11 @@ CREATE TYPE tt_t1 AS (x int, y numeric(8,2));
|
||||
ALTER TABLE tt7 OF tt_t1; -- reassign an already-typed table
|
||||
ALTER TABLE tt7 NOT OF;
|
||||
\d tt7
|
||||
Table "public.tt7"
|
||||
Column | Type | Modifiers
|
||||
--------+--------------+-----------
|
||||
x | integer |
|
||||
y | numeric(8,2) |
|
||||
Table "public.tt7"
|
||||
Column | Type | Collation | Nullable | Default
|
||||
--------+--------------+-----------+----------+---------
|
||||
x | integer | | |
|
||||
y | numeric(8,2) | | |
|
||||
|
||||
-- make sure we can drop a constraint on the parent but it remains on the child
|
||||
CREATE TABLE test_drop_constr_parent (c text CHECK (c IS NOT NULL));
|
||||
@ -2671,11 +2671,11 @@ ALTER TABLE IF EXISTS tt8 ALTER COLUMN f SET DEFAULT 0;
|
||||
ALTER TABLE IF EXISTS tt8 RENAME COLUMN f TO f1;
|
||||
ALTER TABLE IF EXISTS tt8 SET SCHEMA alter2;
|
||||
\d alter2.tt8
|
||||
Table "alter2.tt8"
|
||||
Column | Type | Modifiers
|
||||
--------+---------+--------------------
|
||||
a | integer |
|
||||
f1 | integer | not null default 0
|
||||
Table "alter2.tt8"
|
||||
Column | Type | Collation | Nullable | Default
|
||||
--------+---------+-----------+----------+---------
|
||||
a | integer | | |
|
||||
f1 | integer | | not null | 0
|
||||
Indexes:
|
||||
"xxx" PRIMARY KEY, btree (f1)
|
||||
Check constraints:
|
||||
@ -2888,62 +2888,62 @@ DROP TABLE logged1;
|
||||
-- test ADD COLUMN IF NOT EXISTS
|
||||
CREATE TABLE test_add_column(c1 integer);
|
||||
\d test_add_column
|
||||
Table "public.test_add_column"
|
||||
Column | Type | Modifiers
|
||||
--------+---------+-----------
|
||||
c1 | integer |
|
||||
Table "public.test_add_column"
|
||||
Column | Type | Collation | Nullable | Default
|
||||
--------+---------+-----------+----------+---------
|
||||
c1 | integer | | |
|
||||
|
||||
ALTER TABLE test_add_column
|
||||
ADD COLUMN c2 integer;
|
||||
\d test_add_column
|
||||
Table "public.test_add_column"
|
||||
Column | Type | Modifiers
|
||||
--------+---------+-----------
|
||||
c1 | integer |
|
||||
c2 | integer |
|
||||
Table "public.test_add_column"
|
||||
Column | Type | Collation | Nullable | Default
|
||||
--------+---------+-----------+----------+---------
|
||||
c1 | integer | | |
|
||||
c2 | integer | | |
|
||||
|
||||
ALTER TABLE test_add_column
|
||||
ADD COLUMN c2 integer; -- fail because c2 already exists
|
||||
ERROR: column "c2" of relation "test_add_column" already exists
|
||||
\d test_add_column
|
||||
Table "public.test_add_column"
|
||||
Column | Type | Modifiers
|
||||
--------+---------+-----------
|
||||
c1 | integer |
|
||||
c2 | integer |
|
||||
Table "public.test_add_column"
|
||||
Column | Type | Collation | Nullable | Default
|
||||
--------+---------+-----------+----------+---------
|
||||
c1 | integer | | |
|
||||
c2 | integer | | |
|
||||
|
||||
ALTER TABLE test_add_column
|
||||
ADD COLUMN IF NOT EXISTS c2 integer; -- skipping because c2 already exists
|
||||
NOTICE: column "c2" of relation "test_add_column" already exists, skipping
|
||||
\d test_add_column
|
||||
Table "public.test_add_column"
|
||||
Column | Type | Modifiers
|
||||
--------+---------+-----------
|
||||
c1 | integer |
|
||||
c2 | integer |
|
||||
Table "public.test_add_column"
|
||||
Column | Type | Collation | Nullable | Default
|
||||
--------+---------+-----------+----------+---------
|
||||
c1 | integer | | |
|
||||
c2 | integer | | |
|
||||
|
||||
ALTER TABLE test_add_column
|
||||
ADD COLUMN c2 integer, -- fail because c2 already exists
|
||||
ADD COLUMN c3 integer;
|
||||
ERROR: column "c2" of relation "test_add_column" already exists
|
||||
\d test_add_column
|
||||
Table "public.test_add_column"
|
||||
Column | Type | Modifiers
|
||||
--------+---------+-----------
|
||||
c1 | integer |
|
||||
c2 | integer |
|
||||
Table "public.test_add_column"
|
||||
Column | Type | Collation | Nullable | Default
|
||||
--------+---------+-----------+----------+---------
|
||||
c1 | integer | | |
|
||||
c2 | integer | | |
|
||||
|
||||
ALTER TABLE test_add_column
|
||||
ADD COLUMN IF NOT EXISTS c2 integer, -- skipping because c2 already exists
|
||||
ADD COLUMN c3 integer; -- fail because c3 already exists
|
||||
NOTICE: column "c2" of relation "test_add_column" already exists, skipping
|
||||
\d test_add_column
|
||||
Table "public.test_add_column"
|
||||
Column | Type | Modifiers
|
||||
--------+---------+-----------
|
||||
c1 | integer |
|
||||
c2 | integer |
|
||||
c3 | integer |
|
||||
Table "public.test_add_column"
|
||||
Column | Type | Collation | Nullable | Default
|
||||
--------+---------+-----------+----------+---------
|
||||
c1 | integer | | |
|
||||
c2 | integer | | |
|
||||
c3 | integer | | |
|
||||
|
||||
ALTER TABLE test_add_column
|
||||
ADD COLUMN IF NOT EXISTS c2 integer, -- skipping because c2 already exists
|
||||
@ -2951,12 +2951,12 @@ ALTER TABLE test_add_column
|
||||
NOTICE: column "c2" of relation "test_add_column" already exists, skipping
|
||||
NOTICE: column "c3" of relation "test_add_column" already exists, skipping
|
||||
\d test_add_column
|
||||
Table "public.test_add_column"
|
||||
Column | Type | Modifiers
|
||||
--------+---------+-----------
|
||||
c1 | integer |
|
||||
c2 | integer |
|
||||
c3 | integer |
|
||||
Table "public.test_add_column"
|
||||
Column | Type | Collation | Nullable | Default
|
||||
--------+---------+-----------+----------+---------
|
||||
c1 | integer | | |
|
||||
c2 | integer | | |
|
||||
c3 | integer | | |
|
||||
|
||||
ALTER TABLE test_add_column
|
||||
ADD COLUMN IF NOT EXISTS c2 integer, -- skipping because c2 already exists
|
||||
@ -2965,12 +2965,12 @@ ALTER TABLE test_add_column
|
||||
NOTICE: column "c2" of relation "test_add_column" already exists, skipping
|
||||
NOTICE: column "c3" of relation "test_add_column" already exists, skipping
|
||||
\d test_add_column
|
||||
Table "public.test_add_column"
|
||||
Column | Type | Modifiers
|
||||
--------+---------+-----------
|
||||
c1 | integer |
|
||||
c2 | integer |
|
||||
c3 | integer |
|
||||
c4 | integer |
|
||||
Table "public.test_add_column"
|
||||
Column | Type | Collation | Nullable | Default
|
||||
--------+---------+-----------+----------+---------
|
||||
c1 | integer | | |
|
||||
c2 | integer | | |
|
||||
c3 | integer | | |
|
||||
c4 | integer | | |
|
||||
|
||||
DROP TABLE test_add_column;
|
||||
|
@ -9,11 +9,11 @@ CREATE TABLE collate_test1 (
|
||||
b text COLLATE "en_US" NOT NULL
|
||||
);
|
||||
\d collate_test1
|
||||
Table "public.collate_test1"
|
||||
Column | Type | Modifiers
|
||||
--------+---------+------------------------
|
||||
a | integer |
|
||||
b | text | collate en_US not null
|
||||
Table "public.collate_test1"
|
||||
Column | Type | Collation | Nullable | Default
|
||||
--------+---------+-----------+----------+---------
|
||||
a | integer | | |
|
||||
b | text | en_US | not null |
|
||||
|
||||
CREATE TABLE collate_test_fail (
|
||||
a int,
|
||||
@ -40,11 +40,11 @@ CREATE TABLE collate_test_like (
|
||||
LIKE collate_test1
|
||||
);
|
||||
\d collate_test_like
|
||||
Table "public.collate_test_like"
|
||||
Column | Type | Modifiers
|
||||
--------+---------+------------------------
|
||||
a | integer |
|
||||
b | text | collate en_US not null
|
||||
Table "public.collate_test_like"
|
||||
Column | Type | Collation | Nullable | Default
|
||||
--------+---------+-----------+----------+---------
|
||||
a | integer | | |
|
||||
b | text | en_US | not null |
|
||||
|
||||
CREATE TABLE collate_test2 (
|
||||
a int,
|
||||
@ -1044,16 +1044,16 @@ drop cascades to composite type collate_dep_test2 column y
|
||||
drop cascades to view collate_dep_test3
|
||||
drop cascades to index collate_dep_test4i
|
||||
\d collate_dep_test1
|
||||
Table "public.collate_dep_test1"
|
||||
Column | Type | Modifiers
|
||||
--------+---------+-----------
|
||||
a | integer |
|
||||
Table "public.collate_dep_test1"
|
||||
Column | Type | Collation | Nullable | Default
|
||||
--------+---------+-----------+----------+---------
|
||||
a | integer | | |
|
||||
|
||||
\d collate_dep_test2
|
||||
Composite type "public.collate_dep_test2"
|
||||
Column | Type | Modifiers
|
||||
--------+---------+-----------
|
||||
x | integer |
|
||||
Composite type "public.collate_dep_test2"
|
||||
Column | Type | Collation | Nullable | Default
|
||||
--------+---------+-----------+----------+---------
|
||||
x | integer | | |
|
||||
|
||||
DROP TABLE collate_dep_test1, collate_dep_test4t;
|
||||
DROP TYPE collate_dep_test2;
|
||||
|
@ -16,11 +16,11 @@ CREATE TABLE collate_test1 (
|
||||
b text COLLATE "C" NOT NULL
|
||||
);
|
||||
\d collate_test1
|
||||
Table "collate_tests.collate_test1"
|
||||
Column | Type | Modifiers
|
||||
--------+---------+--------------------
|
||||
a | integer |
|
||||
b | text | collate C not null
|
||||
Table "collate_tests.collate_test1"
|
||||
Column | Type | Collation | Nullable | Default
|
||||
--------+---------+-----------+----------+---------
|
||||
a | integer | | |
|
||||
b | text | C | not null |
|
||||
|
||||
CREATE TABLE collate_test_fail (
|
||||
a int COLLATE "C",
|
||||
@ -33,11 +33,11 @@ CREATE TABLE collate_test_like (
|
||||
LIKE collate_test1
|
||||
);
|
||||
\d collate_test_like
|
||||
Table "collate_tests.collate_test_like"
|
||||
Column | Type | Modifiers
|
||||
--------+---------+--------------------
|
||||
a | integer |
|
||||
b | text | collate C not null
|
||||
Table "collate_tests.collate_test_like"
|
||||
Column | Type | Collation | Nullable | Default
|
||||
--------+---------+-----------+----------+---------
|
||||
a | integer | | |
|
||||
b | text | C | not null |
|
||||
|
||||
CREATE TABLE collate_test2 (
|
||||
a int,
|
||||
|
@ -438,10 +438,10 @@ begin
|
||||
end $$ language plpgsql immutable;
|
||||
alter table check_con_tbl add check (check_con_function(check_con_tbl.*));
|
||||
\d+ check_con_tbl
|
||||
Table "public.check_con_tbl"
|
||||
Column | Type | Modifiers | Storage | Stats target | Description
|
||||
--------+---------+-----------+---------+--------------+-------------
|
||||
f1 | integer | | plain | |
|
||||
Table "public.check_con_tbl"
|
||||
Column | Type | Collation | Nullable | Default | Storage | Stats target | Description
|
||||
--------+---------+-----------+----------+---------+---------+--------------+-------------
|
||||
f1 | integer | | | | plain | |
|
||||
Check constraints:
|
||||
"check_con_tbl_check" CHECK (check_con_function(check_con_tbl.*))
|
||||
|
||||
|
@ -2452,11 +2452,11 @@ DETAIL: Key (f2)=(b) is duplicated.
|
||||
DELETE FROM concur_heap WHERE f1 = 'b';
|
||||
VACUUM FULL concur_heap;
|
||||
\d concur_heap
|
||||
Table "public.concur_heap"
|
||||
Column | Type | Modifiers
|
||||
--------+------+-----------
|
||||
f1 | text |
|
||||
f2 | text |
|
||||
Table "public.concur_heap"
|
||||
Column | Type | Collation | Nullable | Default
|
||||
--------+------+-----------+----------+---------
|
||||
f1 | text | | |
|
||||
f2 | text | | |
|
||||
Indexes:
|
||||
"concur_index2" UNIQUE, btree (f1)
|
||||
"concur_index3" UNIQUE, btree (f2) INVALID
|
||||
@ -2468,11 +2468,11 @@ Indexes:
|
||||
|
||||
REINDEX TABLE concur_heap;
|
||||
\d concur_heap
|
||||
Table "public.concur_heap"
|
||||
Column | Type | Modifiers
|
||||
--------+------+-----------
|
||||
f1 | text |
|
||||
f2 | text |
|
||||
Table "public.concur_heap"
|
||||
Column | Type | Collation | Nullable | Default
|
||||
--------+------+-----------+----------+---------
|
||||
f1 | text | | |
|
||||
f2 | text | | |
|
||||
Indexes:
|
||||
"concur_index2" UNIQUE, btree (f1)
|
||||
"concur_index3" UNIQUE, btree (f2)
|
||||
@ -2502,11 +2502,11 @@ DROP INDEX CONCURRENTLY "concur_index5";
|
||||
DROP INDEX CONCURRENTLY "concur_index1";
|
||||
DROP INDEX CONCURRENTLY "concur_heap_expr_idx";
|
||||
\d concur_heap
|
||||
Table "public.concur_heap"
|
||||
Column | Type | Modifiers
|
||||
--------+------+-----------
|
||||
f1 | text |
|
||||
f2 | text |
|
||||
Table "public.concur_heap"
|
||||
Column | Type | Collation | Nullable | Default
|
||||
--------+------+-----------+----------+---------
|
||||
f1 | text | | |
|
||||
f2 | text | | |
|
||||
Indexes:
|
||||
"std_index" btree (f2)
|
||||
|
||||
@ -2520,12 +2520,12 @@ INSERT INTO cwi_test VALUES(1, 2), (3, 4), (5, 6);
|
||||
CREATE UNIQUE INDEX cwi_uniq_idx ON cwi_test(a , b);
|
||||
ALTER TABLE cwi_test ADD primary key USING INDEX cwi_uniq_idx;
|
||||
\d cwi_test
|
||||
Table "public.cwi_test"
|
||||
Column | Type | Modifiers
|
||||
--------+-----------------------+-----------
|
||||
a | integer | not null
|
||||
b | character varying(10) | not null
|
||||
c | character(1) |
|
||||
Table "public.cwi_test"
|
||||
Column | Type | Collation | Nullable | Default
|
||||
--------+-----------------------+-----------+----------+---------
|
||||
a | integer | | not null |
|
||||
b | character varying(10) | | not null |
|
||||
c | character(1) | | |
|
||||
Indexes:
|
||||
"cwi_uniq_idx" PRIMARY KEY, btree (a, b)
|
||||
|
||||
@ -2543,12 +2543,12 @@ ALTER TABLE cwi_test DROP CONSTRAINT cwi_uniq_idx,
|
||||
USING INDEX cwi_uniq2_idx;
|
||||
NOTICE: ALTER TABLE / ADD CONSTRAINT USING INDEX will rename index "cwi_uniq2_idx" to "cwi_replaced_pkey"
|
||||
\d cwi_test
|
||||
Table "public.cwi_test"
|
||||
Column | Type | Modifiers
|
||||
--------+-----------------------+-----------
|
||||
a | integer | not null
|
||||
b | character varying(10) | not null
|
||||
c | character(1) |
|
||||
Table "public.cwi_test"
|
||||
Column | Type | Collation | Nullable | Default
|
||||
--------+-----------------------+-----------+----------+---------
|
||||
a | integer | | not null |
|
||||
b | character varying(10) | | not null |
|
||||
c | character(1) | | |
|
||||
Indexes:
|
||||
"cwi_replaced_pkey" PRIMARY KEY, btree (b, a)
|
||||
|
||||
|
@ -109,32 +109,32 @@ CREATE TABLE ctlt4 (a text, c text);
|
||||
ALTER TABLE ctlt4 ALTER COLUMN c SET STORAGE EXTERNAL;
|
||||
CREATE TABLE ctlt12_storage (LIKE ctlt1 INCLUDING STORAGE, LIKE ctlt2 INCLUDING STORAGE);
|
||||
\d+ ctlt12_storage
|
||||
Table "public.ctlt12_storage"
|
||||
Column | Type | Modifiers | Storage | Stats target | Description
|
||||
--------+------+-----------+----------+--------------+-------------
|
||||
a | text | not null | main | |
|
||||
b | text | | extended | |
|
||||
c | text | | external | |
|
||||
Table "public.ctlt12_storage"
|
||||
Column | Type | Collation | Nullable | Default | Storage | Stats target | Description
|
||||
--------+------+-----------+----------+---------+----------+--------------+-------------
|
||||
a | text | | not null | | main | |
|
||||
b | text | | | | extended | |
|
||||
c | text | | | | external | |
|
||||
|
||||
CREATE TABLE ctlt12_comments (LIKE ctlt1 INCLUDING COMMENTS, LIKE ctlt2 INCLUDING COMMENTS);
|
||||
\d+ ctlt12_comments
|
||||
Table "public.ctlt12_comments"
|
||||
Column | Type | Modifiers | Storage | Stats target | Description
|
||||
--------+------+-----------+----------+--------------+-------------
|
||||
a | text | not null | extended | | A
|
||||
b | text | | extended | | B
|
||||
c | text | | extended | | C
|
||||
Table "public.ctlt12_comments"
|
||||
Column | Type | Collation | Nullable | Default | Storage | Stats target | Description
|
||||
--------+------+-----------+----------+---------+----------+--------------+-------------
|
||||
a | text | | not null | | extended | | A
|
||||
b | text | | | | extended | | B
|
||||
c | text | | | | extended | | C
|
||||
|
||||
CREATE TABLE ctlt1_inh (LIKE ctlt1 INCLUDING CONSTRAINTS INCLUDING COMMENTS) INHERITS (ctlt1);
|
||||
NOTICE: merging column "a" with inherited definition
|
||||
NOTICE: merging column "b" with inherited definition
|
||||
NOTICE: merging constraint "ctlt1_a_check" with inherited definition
|
||||
\d+ ctlt1_inh
|
||||
Table "public.ctlt1_inh"
|
||||
Column | Type | Modifiers | Storage | Stats target | Description
|
||||
--------+------+-----------+----------+--------------+-------------
|
||||
a | text | not null | main | | A
|
||||
b | text | | extended | | B
|
||||
Table "public.ctlt1_inh"
|
||||
Column | Type | Collation | Nullable | Default | Storage | Stats target | Description
|
||||
--------+------+-----------+----------+---------+----------+--------------+-------------
|
||||
a | text | | not null | | main | | A
|
||||
b | text | | | | extended | | B
|
||||
Check constraints:
|
||||
"ctlt1_a_check" CHECK (length(a) > 2)
|
||||
Inherits: ctlt1
|
||||
@ -148,12 +148,12 @@ SELECT description FROM pg_description, pg_constraint c WHERE classoid = 'pg_con
|
||||
CREATE TABLE ctlt13_inh () INHERITS (ctlt1, ctlt3);
|
||||
NOTICE: merging multiple inherited definitions of column "a"
|
||||
\d+ ctlt13_inh
|
||||
Table "public.ctlt13_inh"
|
||||
Column | Type | Modifiers | Storage | Stats target | Description
|
||||
--------+------+-----------+----------+--------------+-------------
|
||||
a | text | not null | main | |
|
||||
b | text | | extended | |
|
||||
c | text | | external | |
|
||||
Table "public.ctlt13_inh"
|
||||
Column | Type | Collation | Nullable | Default | Storage | Stats target | Description
|
||||
--------+------+-----------+----------+---------+----------+--------------+-------------
|
||||
a | text | | not null | | main | |
|
||||
b | text | | | | extended | |
|
||||
c | text | | | | external | |
|
||||
Check constraints:
|
||||
"ctlt1_a_check" CHECK (length(a) > 2)
|
||||
"ctlt3_a_check" CHECK (length(a) < 5)
|
||||
@ -163,12 +163,12 @@ Inherits: ctlt1,
|
||||
CREATE TABLE ctlt13_like (LIKE ctlt3 INCLUDING CONSTRAINTS INCLUDING COMMENTS INCLUDING STORAGE) INHERITS (ctlt1);
|
||||
NOTICE: merging column "a" with inherited definition
|
||||
\d+ ctlt13_like
|
||||
Table "public.ctlt13_like"
|
||||
Column | Type | Modifiers | Storage | Stats target | Description
|
||||
--------+------+-----------+----------+--------------+-------------
|
||||
a | text | not null | main | | A3
|
||||
b | text | | extended | |
|
||||
c | text | | external | | C
|
||||
Table "public.ctlt13_like"
|
||||
Column | Type | Collation | Nullable | Default | Storage | Stats target | Description
|
||||
--------+------+-----------+----------+---------+----------+--------------+-------------
|
||||
a | text | | not null | | main | | A3
|
||||
b | text | | | | extended | |
|
||||
c | text | | | | external | | C
|
||||
Check constraints:
|
||||
"ctlt1_a_check" CHECK (length(a) > 2)
|
||||
"ctlt3_a_check" CHECK (length(a) < 5)
|
||||
@ -182,11 +182,11 @@ SELECT description FROM pg_description, pg_constraint c WHERE classoid = 'pg_con
|
||||
|
||||
CREATE TABLE ctlt_all (LIKE ctlt1 INCLUDING ALL);
|
||||
\d+ ctlt_all
|
||||
Table "public.ctlt_all"
|
||||
Column | Type | Modifiers | Storage | Stats target | Description
|
||||
--------+------+-----------+----------+--------------+-------------
|
||||
a | text | not null | main | | A
|
||||
b | text | | extended | | B
|
||||
Table "public.ctlt_all"
|
||||
Column | Type | Collation | Nullable | Default | Storage | Stats target | Description
|
||||
--------+------+-----------+----------+---------+----------+--------------+-------------
|
||||
a | text | | not null | | main | | A
|
||||
b | text | | | | extended | | B
|
||||
Indexes:
|
||||
"ctlt_all_pkey" PRIMARY KEY, btree (a)
|
||||
"ctlt_all_b_idx" btree (b)
|
||||
|
@ -305,12 +305,12 @@ CREATE VIEW aliased_view_4 AS
|
||||
select * from temp_view_test.tt1
|
||||
where exists (select 1 from tt1 where temp_view_test.tt1.y1 = tt1.f1);
|
||||
\d+ aliased_view_1
|
||||
View "testviewschm2.aliased_view_1"
|
||||
Column | Type | Modifiers | Storage | Description
|
||||
--------+---------+-----------+----------+-------------
|
||||
f1 | integer | | plain |
|
||||
f2 | integer | | plain |
|
||||
f3 | text | | extended |
|
||||
View "testviewschm2.aliased_view_1"
|
||||
Column | Type | Collation | Nullable | Default | Storage | Description
|
||||
--------+---------+-----------+----------+---------+----------+-------------
|
||||
f1 | integer | | | | plain |
|
||||
f2 | integer | | | | plain |
|
||||
f3 | text | | | | extended |
|
||||
View definition:
|
||||
SELECT tt1.f1,
|
||||
tt1.f2,
|
||||
@ -321,12 +321,12 @@ View definition:
|
||||
WHERE tt1.f1 = tx1.x1));
|
||||
|
||||
\d+ aliased_view_2
|
||||
View "testviewschm2.aliased_view_2"
|
||||
Column | Type | Modifiers | Storage | Description
|
||||
--------+---------+-----------+----------+-------------
|
||||
f1 | integer | | plain |
|
||||
f2 | integer | | plain |
|
||||
f3 | text | | extended |
|
||||
View "testviewschm2.aliased_view_2"
|
||||
Column | Type | Collation | Nullable | Default | Storage | Description
|
||||
--------+---------+-----------+----------+---------+----------+-------------
|
||||
f1 | integer | | | | plain |
|
||||
f2 | integer | | | | plain |
|
||||
f3 | text | | | | extended |
|
||||
View definition:
|
||||
SELECT a1.f1,
|
||||
a1.f2,
|
||||
@ -337,12 +337,12 @@ View definition:
|
||||
WHERE a1.f1 = tx1.x1));
|
||||
|
||||
\d+ aliased_view_3
|
||||
View "testviewschm2.aliased_view_3"
|
||||
Column | Type | Modifiers | Storage | Description
|
||||
--------+---------+-----------+----------+-------------
|
||||
f1 | integer | | plain |
|
||||
f2 | integer | | plain |
|
||||
f3 | text | | extended |
|
||||
View "testviewschm2.aliased_view_3"
|
||||
Column | Type | Collation | Nullable | Default | Storage | Description
|
||||
--------+---------+-----------+----------+---------+----------+-------------
|
||||
f1 | integer | | | | plain |
|
||||
f2 | integer | | | | plain |
|
||||
f3 | text | | | | extended |
|
||||
View definition:
|
||||
SELECT tt1.f1,
|
||||
tt1.f2,
|
||||
@ -353,12 +353,12 @@ View definition:
|
||||
WHERE tt1.f1 = a2.x1));
|
||||
|
||||
\d+ aliased_view_4
|
||||
View "testviewschm2.aliased_view_4"
|
||||
Column | Type | Modifiers | Storage | Description
|
||||
--------+---------+-----------+----------+-------------
|
||||
y1 | integer | | plain |
|
||||
f2 | integer | | plain |
|
||||
f3 | text | | extended |
|
||||
View "testviewschm2.aliased_view_4"
|
||||
Column | Type | Collation | Nullable | Default | Storage | Description
|
||||
--------+---------+-----------+----------+---------+----------+-------------
|
||||
y1 | integer | | | | plain |
|
||||
f2 | integer | | | | plain |
|
||||
f3 | text | | | | extended |
|
||||
View definition:
|
||||
SELECT tt1.y1,
|
||||
tt1.f2,
|
||||
@ -370,12 +370,12 @@ View definition:
|
||||
|
||||
ALTER TABLE tx1 RENAME TO a1;
|
||||
\d+ aliased_view_1
|
||||
View "testviewschm2.aliased_view_1"
|
||||
Column | Type | Modifiers | Storage | Description
|
||||
--------+---------+-----------+----------+-------------
|
||||
f1 | integer | | plain |
|
||||
f2 | integer | | plain |
|
||||
f3 | text | | extended |
|
||||
View "testviewschm2.aliased_view_1"
|
||||
Column | Type | Collation | Nullable | Default | Storage | Description
|
||||
--------+---------+-----------+----------+---------+----------+-------------
|
||||
f1 | integer | | | | plain |
|
||||
f2 | integer | | | | plain |
|
||||
f3 | text | | | | extended |
|
||||
View definition:
|
||||
SELECT tt1.f1,
|
||||
tt1.f2,
|
||||
@ -386,12 +386,12 @@ View definition:
|
||||
WHERE tt1.f1 = a1.x1));
|
||||
|
||||
\d+ aliased_view_2
|
||||
View "testviewschm2.aliased_view_2"
|
||||
Column | Type | Modifiers | Storage | Description
|
||||
--------+---------+-----------+----------+-------------
|
||||
f1 | integer | | plain |
|
||||
f2 | integer | | plain |
|
||||
f3 | text | | extended |
|
||||
View "testviewschm2.aliased_view_2"
|
||||
Column | Type | Collation | Nullable | Default | Storage | Description
|
||||
--------+---------+-----------+----------+---------+----------+-------------
|
||||
f1 | integer | | | | plain |
|
||||
f2 | integer | | | | plain |
|
||||
f3 | text | | | | extended |
|
||||
View definition:
|
||||
SELECT a1.f1,
|
||||
a1.f2,
|
||||
@ -402,12 +402,12 @@ View definition:
|
||||
WHERE a1.f1 = a1_1.x1));
|
||||
|
||||
\d+ aliased_view_3
|
||||
View "testviewschm2.aliased_view_3"
|
||||
Column | Type | Modifiers | Storage | Description
|
||||
--------+---------+-----------+----------+-------------
|
||||
f1 | integer | | plain |
|
||||
f2 | integer | | plain |
|
||||
f3 | text | | extended |
|
||||
View "testviewschm2.aliased_view_3"
|
||||
Column | Type | Collation | Nullable | Default | Storage | Description
|
||||
--------+---------+-----------+----------+---------+----------+-------------
|
||||
f1 | integer | | | | plain |
|
||||
f2 | integer | | | | plain |
|
||||
f3 | text | | | | extended |
|
||||
View definition:
|
||||
SELECT tt1.f1,
|
||||
tt1.f2,
|
||||
@ -418,12 +418,12 @@ View definition:
|
||||
WHERE tt1.f1 = a2.x1));
|
||||
|
||||
\d+ aliased_view_4
|
||||
View "testviewschm2.aliased_view_4"
|
||||
Column | Type | Modifiers | Storage | Description
|
||||
--------+---------+-----------+----------+-------------
|
||||
y1 | integer | | plain |
|
||||
f2 | integer | | plain |
|
||||
f3 | text | | extended |
|
||||
View "testviewschm2.aliased_view_4"
|
||||
Column | Type | Collation | Nullable | Default | Storage | Description
|
||||
--------+---------+-----------+----------+---------+----------+-------------
|
||||
y1 | integer | | | | plain |
|
||||
f2 | integer | | | | plain |
|
||||
f3 | text | | | | extended |
|
||||
View definition:
|
||||
SELECT tt1.y1,
|
||||
tt1.f2,
|
||||
@ -435,12 +435,12 @@ View definition:
|
||||
|
||||
ALTER TABLE tt1 RENAME TO a2;
|
||||
\d+ aliased_view_1
|
||||
View "testviewschm2.aliased_view_1"
|
||||
Column | Type | Modifiers | Storage | Description
|
||||
--------+---------+-----------+----------+-------------
|
||||
f1 | integer | | plain |
|
||||
f2 | integer | | plain |
|
||||
f3 | text | | extended |
|
||||
View "testviewschm2.aliased_view_1"
|
||||
Column | Type | Collation | Nullable | Default | Storage | Description
|
||||
--------+---------+-----------+----------+---------+----------+-------------
|
||||
f1 | integer | | | | plain |
|
||||
f2 | integer | | | | plain |
|
||||
f3 | text | | | | extended |
|
||||
View definition:
|
||||
SELECT a2.f1,
|
||||
a2.f2,
|
||||
@ -451,12 +451,12 @@ View definition:
|
||||
WHERE a2.f1 = a1.x1));
|
||||
|
||||
\d+ aliased_view_2
|
||||
View "testviewschm2.aliased_view_2"
|
||||
Column | Type | Modifiers | Storage | Description
|
||||
--------+---------+-----------+----------+-------------
|
||||
f1 | integer | | plain |
|
||||
f2 | integer | | plain |
|
||||
f3 | text | | extended |
|
||||
View "testviewschm2.aliased_view_2"
|
||||
Column | Type | Collation | Nullable | Default | Storage | Description
|
||||
--------+---------+-----------+----------+---------+----------+-------------
|
||||
f1 | integer | | | | plain |
|
||||
f2 | integer | | | | plain |
|
||||
f3 | text | | | | extended |
|
||||
View definition:
|
||||
SELECT a1.f1,
|
||||
a1.f2,
|
||||
@ -467,12 +467,12 @@ View definition:
|
||||
WHERE a1.f1 = a1_1.x1));
|
||||
|
||||
\d+ aliased_view_3
|
||||
View "testviewschm2.aliased_view_3"
|
||||
Column | Type | Modifiers | Storage | Description
|
||||
--------+---------+-----------+----------+-------------
|
||||
f1 | integer | | plain |
|
||||
f2 | integer | | plain |
|
||||
f3 | text | | extended |
|
||||
View "testviewschm2.aliased_view_3"
|
||||
Column | Type | Collation | Nullable | Default | Storage | Description
|
||||
--------+---------+-----------+----------+---------+----------+-------------
|
||||
f1 | integer | | | | plain |
|
||||
f2 | integer | | | | plain |
|
||||
f3 | text | | | | extended |
|
||||
View definition:
|
||||
SELECT a2.f1,
|
||||
a2.f2,
|
||||
@ -483,12 +483,12 @@ View definition:
|
||||
WHERE a2.f1 = a2_1.x1));
|
||||
|
||||
\d+ aliased_view_4
|
||||
View "testviewschm2.aliased_view_4"
|
||||
Column | Type | Modifiers | Storage | Description
|
||||
--------+---------+-----------+----------+-------------
|
||||
y1 | integer | | plain |
|
||||
f2 | integer | | plain |
|
||||
f3 | text | | extended |
|
||||
View "testviewschm2.aliased_view_4"
|
||||
Column | Type | Collation | Nullable | Default | Storage | Description
|
||||
--------+---------+-----------+----------+---------+----------+-------------
|
||||
y1 | integer | | | | plain |
|
||||
f2 | integer | | | | plain |
|
||||
f3 | text | | | | extended |
|
||||
View definition:
|
||||
SELECT tt1.y1,
|
||||
tt1.f2,
|
||||
@ -500,12 +500,12 @@ View definition:
|
||||
|
||||
ALTER TABLE a1 RENAME TO tt1;
|
||||
\d+ aliased_view_1
|
||||
View "testviewschm2.aliased_view_1"
|
||||
Column | Type | Modifiers | Storage | Description
|
||||
--------+---------+-----------+----------+-------------
|
||||
f1 | integer | | plain |
|
||||
f2 | integer | | plain |
|
||||
f3 | text | | extended |
|
||||
View "testviewschm2.aliased_view_1"
|
||||
Column | Type | Collation | Nullable | Default | Storage | Description
|
||||
--------+---------+-----------+----------+---------+----------+-------------
|
||||
f1 | integer | | | | plain |
|
||||
f2 | integer | | | | plain |
|
||||
f3 | text | | | | extended |
|
||||
View definition:
|
||||
SELECT a2.f1,
|
||||
a2.f2,
|
||||
@ -516,12 +516,12 @@ View definition:
|
||||
WHERE a2.f1 = tt1.x1));
|
||||
|
||||
\d+ aliased_view_2
|
||||
View "testviewschm2.aliased_view_2"
|
||||
Column | Type | Modifiers | Storage | Description
|
||||
--------+---------+-----------+----------+-------------
|
||||
f1 | integer | | plain |
|
||||
f2 | integer | | plain |
|
||||
f3 | text | | extended |
|
||||
View "testviewschm2.aliased_view_2"
|
||||
Column | Type | Collation | Nullable | Default | Storage | Description
|
||||
--------+---------+-----------+----------+---------+----------+-------------
|
||||
f1 | integer | | | | plain |
|
||||
f2 | integer | | | | plain |
|
||||
f3 | text | | | | extended |
|
||||
View definition:
|
||||
SELECT a1.f1,
|
||||
a1.f2,
|
||||
@ -532,12 +532,12 @@ View definition:
|
||||
WHERE a1.f1 = tt1.x1));
|
||||
|
||||
\d+ aliased_view_3
|
||||
View "testviewschm2.aliased_view_3"
|
||||
Column | Type | Modifiers | Storage | Description
|
||||
--------+---------+-----------+----------+-------------
|
||||
f1 | integer | | plain |
|
||||
f2 | integer | | plain |
|
||||
f3 | text | | extended |
|
||||
View "testviewschm2.aliased_view_3"
|
||||
Column | Type | Collation | Nullable | Default | Storage | Description
|
||||
--------+---------+-----------+----------+---------+----------+-------------
|
||||
f1 | integer | | | | plain |
|
||||
f2 | integer | | | | plain |
|
||||
f3 | text | | | | extended |
|
||||
View definition:
|
||||
SELECT a2.f1,
|
||||
a2.f2,
|
||||
@ -548,12 +548,12 @@ View definition:
|
||||
WHERE a2.f1 = a2_1.x1));
|
||||
|
||||
\d+ aliased_view_4
|
||||
View "testviewschm2.aliased_view_4"
|
||||
Column | Type | Modifiers | Storage | Description
|
||||
--------+---------+-----------+----------+-------------
|
||||
y1 | integer | | plain |
|
||||
f2 | integer | | plain |
|
||||
f3 | text | | extended |
|
||||
View "testviewschm2.aliased_view_4"
|
||||
Column | Type | Collation | Nullable | Default | Storage | Description
|
||||
--------+---------+-----------+----------+---------+----------+-------------
|
||||
y1 | integer | | | | plain |
|
||||
f2 | integer | | | | plain |
|
||||
f3 | text | | | | extended |
|
||||
View definition:
|
||||
SELECT tt1.y1,
|
||||
tt1.f2,
|
||||
@ -566,12 +566,12 @@ View definition:
|
||||
ALTER TABLE a2 RENAME TO tx1;
|
||||
ALTER TABLE tx1 SET SCHEMA temp_view_test;
|
||||
\d+ aliased_view_1
|
||||
View "testviewschm2.aliased_view_1"
|
||||
Column | Type | Modifiers | Storage | Description
|
||||
--------+---------+-----------+----------+-------------
|
||||
f1 | integer | | plain |
|
||||
f2 | integer | | plain |
|
||||
f3 | text | | extended |
|
||||
View "testviewschm2.aliased_view_1"
|
||||
Column | Type | Collation | Nullable | Default | Storage | Description
|
||||
--------+---------+-----------+----------+---------+----------+-------------
|
||||
f1 | integer | | | | plain |
|
||||
f2 | integer | | | | plain |
|
||||
f3 | text | | | | extended |
|
||||
View definition:
|
||||
SELECT tx1.f1,
|
||||
tx1.f2,
|
||||
@ -582,12 +582,12 @@ View definition:
|
||||
WHERE tx1.f1 = tt1.x1));
|
||||
|
||||
\d+ aliased_view_2
|
||||
View "testviewschm2.aliased_view_2"
|
||||
Column | Type | Modifiers | Storage | Description
|
||||
--------+---------+-----------+----------+-------------
|
||||
f1 | integer | | plain |
|
||||
f2 | integer | | plain |
|
||||
f3 | text | | extended |
|
||||
View "testviewschm2.aliased_view_2"
|
||||
Column | Type | Collation | Nullable | Default | Storage | Description
|
||||
--------+---------+-----------+----------+---------+----------+-------------
|
||||
f1 | integer | | | | plain |
|
||||
f2 | integer | | | | plain |
|
||||
f3 | text | | | | extended |
|
||||
View definition:
|
||||
SELECT a1.f1,
|
||||
a1.f2,
|
||||
@ -598,12 +598,12 @@ View definition:
|
||||
WHERE a1.f1 = tt1.x1));
|
||||
|
||||
\d+ aliased_view_3
|
||||
View "testviewschm2.aliased_view_3"
|
||||
Column | Type | Modifiers | Storage | Description
|
||||
--------+---------+-----------+----------+-------------
|
||||
f1 | integer | | plain |
|
||||
f2 | integer | | plain |
|
||||
f3 | text | | extended |
|
||||
View "testviewschm2.aliased_view_3"
|
||||
Column | Type | Collation | Nullable | Default | Storage | Description
|
||||
--------+---------+-----------+----------+---------+----------+-------------
|
||||
f1 | integer | | | | plain |
|
||||
f2 | integer | | | | plain |
|
||||
f3 | text | | | | extended |
|
||||
View definition:
|
||||
SELECT tx1.f1,
|
||||
tx1.f2,
|
||||
@ -614,12 +614,12 @@ View definition:
|
||||
WHERE tx1.f1 = a2.x1));
|
||||
|
||||
\d+ aliased_view_4
|
||||
View "testviewschm2.aliased_view_4"
|
||||
Column | Type | Modifiers | Storage | Description
|
||||
--------+---------+-----------+----------+-------------
|
||||
y1 | integer | | plain |
|
||||
f2 | integer | | plain |
|
||||
f3 | text | | extended |
|
||||
View "testviewschm2.aliased_view_4"
|
||||
Column | Type | Collation | Nullable | Default | Storage | Description
|
||||
--------+---------+-----------+----------+---------+----------+-------------
|
||||
y1 | integer | | | | plain |
|
||||
f2 | integer | | | | plain |
|
||||
f3 | text | | | | extended |
|
||||
View definition:
|
||||
SELECT tt1.y1,
|
||||
tt1.f2,
|
||||
@ -633,12 +633,12 @@ ALTER TABLE temp_view_test.tt1 RENAME TO tmp1;
|
||||
ALTER TABLE temp_view_test.tmp1 SET SCHEMA testviewschm2;
|
||||
ALTER TABLE tmp1 RENAME TO tx1;
|
||||
\d+ aliased_view_1
|
||||
View "testviewschm2.aliased_view_1"
|
||||
Column | Type | Modifiers | Storage | Description
|
||||
--------+---------+-----------+----------+-------------
|
||||
f1 | integer | | plain |
|
||||
f2 | integer | | plain |
|
||||
f3 | text | | extended |
|
||||
View "testviewschm2.aliased_view_1"
|
||||
Column | Type | Collation | Nullable | Default | Storage | Description
|
||||
--------+---------+-----------+----------+---------+----------+-------------
|
||||
f1 | integer | | | | plain |
|
||||
f2 | integer | | | | plain |
|
||||
f3 | text | | | | extended |
|
||||
View definition:
|
||||
SELECT tx1.f1,
|
||||
tx1.f2,
|
||||
@ -649,12 +649,12 @@ View definition:
|
||||
WHERE tx1.f1 = tt1.x1));
|
||||
|
||||
\d+ aliased_view_2
|
||||
View "testviewschm2.aliased_view_2"
|
||||
Column | Type | Modifiers | Storage | Description
|
||||
--------+---------+-----------+----------+-------------
|
||||
f1 | integer | | plain |
|
||||
f2 | integer | | plain |
|
||||
f3 | text | | extended |
|
||||
View "testviewschm2.aliased_view_2"
|
||||
Column | Type | Collation | Nullable | Default | Storage | Description
|
||||
--------+---------+-----------+----------+---------+----------+-------------
|
||||
f1 | integer | | | | plain |
|
||||
f2 | integer | | | | plain |
|
||||
f3 | text | | | | extended |
|
||||
View definition:
|
||||
SELECT a1.f1,
|
||||
a1.f2,
|
||||
@ -665,12 +665,12 @@ View definition:
|
||||
WHERE a1.f1 = tt1.x1));
|
||||
|
||||
\d+ aliased_view_3
|
||||
View "testviewschm2.aliased_view_3"
|
||||
Column | Type | Modifiers | Storage | Description
|
||||
--------+---------+-----------+----------+-------------
|
||||
f1 | integer | | plain |
|
||||
f2 | integer | | plain |
|
||||
f3 | text | | extended |
|
||||
View "testviewschm2.aliased_view_3"
|
||||
Column | Type | Collation | Nullable | Default | Storage | Description
|
||||
--------+---------+-----------+----------+---------+----------+-------------
|
||||
f1 | integer | | | | plain |
|
||||
f2 | integer | | | | plain |
|
||||
f3 | text | | | | extended |
|
||||
View definition:
|
||||
SELECT tx1.f1,
|
||||
tx1.f2,
|
||||
@ -681,12 +681,12 @@ View definition:
|
||||
WHERE tx1.f1 = a2.x1));
|
||||
|
||||
\d+ aliased_view_4
|
||||
View "testviewschm2.aliased_view_4"
|
||||
Column | Type | Modifiers | Storage | Description
|
||||
--------+---------+-----------+----------+-------------
|
||||
y1 | integer | | plain |
|
||||
f2 | integer | | plain |
|
||||
f3 | text | | extended |
|
||||
View "testviewschm2.aliased_view_4"
|
||||
Column | Type | Collation | Nullable | Default | Storage | Description
|
||||
--------+---------+-----------+----------+---------+----------+-------------
|
||||
y1 | integer | | | | plain |
|
||||
f2 | integer | | | | plain |
|
||||
f3 | text | | | | extended |
|
||||
View definition:
|
||||
SELECT tx1.y1,
|
||||
tx1.f2,
|
||||
|
@ -702,12 +702,12 @@ CREATE FOREIGN TABLE ft1 (
|
||||
COMMENT ON FOREIGN TABLE ft1 IS 'ft1';
|
||||
COMMENT ON COLUMN ft1.c1 IS 'ft1.c1';
|
||||
\d+ ft1
|
||||
Foreign table "public.ft1"
|
||||
Column | Type | Modifiers | FDW Options | Storage | Stats target | Description
|
||||
--------+---------+-----------+--------------------------------+----------+--------------+-------------
|
||||
c1 | integer | not null | ("param 1" 'val1') | plain | | ft1.c1
|
||||
c2 | text | | (param2 'val2', param3 'val3') | extended | |
|
||||
c3 | date | | | plain | |
|
||||
Foreign table "public.ft1"
|
||||
Column | Type | Collation | Nullable | Default | FDW Options | Storage | Stats target | Description
|
||||
--------+---------+-----------+----------+---------+--------------------------------+----------+--------------+-------------
|
||||
c1 | integer | | not null | | ("param 1" 'val1') | plain | | ft1.c1
|
||||
c2 | text | | | | (param2 'val2', param3 'val3') | extended | |
|
||||
c3 | date | | | | | plain | |
|
||||
Check constraints:
|
||||
"ft1_c2_check" CHECK (c2 <> ''::text)
|
||||
"ft1_c3_check" CHECK (c3 >= '01-01-1994'::date AND c3 <= '01-31-1994'::date)
|
||||
@ -757,19 +757,19 @@ ALTER FOREIGN TABLE ft1 ALTER COLUMN c1 SET (n_distinct = 100);
|
||||
ALTER FOREIGN TABLE ft1 ALTER COLUMN c8 SET STATISTICS -1;
|
||||
ALTER FOREIGN TABLE ft1 ALTER COLUMN c8 SET STORAGE PLAIN;
|
||||
\d+ ft1
|
||||
Foreign table "public.ft1"
|
||||
Column | Type | Modifiers | FDW Options | Storage | Stats target | Description
|
||||
--------+---------+-----------+--------------------------------+----------+--------------+-------------
|
||||
c1 | integer | not null | ("param 1" 'val1') | plain | 10000 |
|
||||
c2 | text | | (param2 'val2', param3 'val3') | extended | |
|
||||
c3 | date | | | plain | |
|
||||
c4 | integer | default 0 | | plain | |
|
||||
c5 | integer | | | plain | |
|
||||
c6 | integer | not null | | plain | |
|
||||
c7 | integer | | (p1 'v1', p2 'v2') | plain | |
|
||||
c8 | text | | (p2 'V2') | plain | |
|
||||
c9 | integer | | | plain | |
|
||||
c10 | integer | | (p1 'v1') | plain | |
|
||||
Foreign table "public.ft1"
|
||||
Column | Type | Collation | Nullable | Default | FDW Options | Storage | Stats target | Description
|
||||
--------+---------+-----------+----------+---------+--------------------------------+----------+--------------+-------------
|
||||
c1 | integer | | not null | | ("param 1" 'val1') | plain | 10000 |
|
||||
c2 | text | | | | (param2 'val2', param3 'val3') | extended | |
|
||||
c3 | date | | | | | plain | |
|
||||
c4 | integer | | | 0 | | plain | |
|
||||
c5 | integer | | | | | plain | |
|
||||
c6 | integer | | not null | | | plain | |
|
||||
c7 | integer | | | | (p1 'v1', p2 'v2') | plain | |
|
||||
c8 | text | | | | (p2 'V2') | plain | |
|
||||
c9 | integer | | | | | plain | |
|
||||
c10 | integer | | | | (p1 'v1') | plain | |
|
||||
Check constraints:
|
||||
"ft1_c2_check" CHECK (c2 <> ''::text)
|
||||
"ft1_c3_check" CHECK (c3 >= '01-01-1994'::date AND c3 <= '01-31-1994'::date)
|
||||
@ -807,18 +807,18 @@ ERROR: relation "ft1" does not exist
|
||||
ALTER FOREIGN TABLE foreign_schema.ft1 RENAME c1 TO foreign_column_1;
|
||||
ALTER FOREIGN TABLE foreign_schema.ft1 RENAME TO foreign_table_1;
|
||||
\d foreign_schema.foreign_table_1
|
||||
Foreign table "foreign_schema.foreign_table_1"
|
||||
Column | Type | Modifiers | FDW Options
|
||||
------------------+---------+-----------+--------------------------------
|
||||
foreign_column_1 | integer | not null | ("param 1" 'val1')
|
||||
c2 | text | | (param2 'val2', param3 'val3')
|
||||
c3 | date | |
|
||||
c4 | integer | default 0 |
|
||||
c5 | integer | |
|
||||
c6 | integer | not null |
|
||||
c7 | integer | | (p1 'v1', p2 'v2')
|
||||
c8 | text | | (p2 'V2')
|
||||
c10 | integer | | (p1 'v1')
|
||||
Foreign table "foreign_schema.foreign_table_1"
|
||||
Column | Type | Collation | Nullable | Default | FDW Options
|
||||
------------------+---------+-----------+----------+---------+--------------------------------
|
||||
foreign_column_1 | integer | | not null | | ("param 1" 'val1')
|
||||
c2 | text | | | | (param2 'val2', param3 'val3')
|
||||
c3 | date | | | |
|
||||
c4 | integer | | | 0 |
|
||||
c5 | integer | | | |
|
||||
c6 | integer | | not null | |
|
||||
c7 | integer | | | | (p1 'v1', p2 'v2')
|
||||
c8 | text | | | | (p2 'V2')
|
||||
c10 | integer | | | | (p1 'v1')
|
||||
Check constraints:
|
||||
"ft1_c2_check" CHECK (c2 <> ''::text)
|
||||
"ft1_c3_check" CHECK (c3 >= '01-01-1994'::date AND c3 <= '01-31-1994'::date)
|
||||
@ -1241,33 +1241,33 @@ CREATE TABLE pt1 (
|
||||
CREATE FOREIGN TABLE ft2 () INHERITS (pt1)
|
||||
SERVER s0 OPTIONS (delimiter ',', quote '"', "be quoted" 'value');
|
||||
\d+ pt1
|
||||
Table "public.pt1"
|
||||
Column | Type | Modifiers | Storage | Stats target | Description
|
||||
--------+---------+-----------+----------+--------------+-------------
|
||||
c1 | integer | not null | plain | |
|
||||
c2 | text | | extended | |
|
||||
c3 | date | | plain | |
|
||||
Table "public.pt1"
|
||||
Column | Type | Collation | Nullable | Default | Storage | Stats target | Description
|
||||
--------+---------+-----------+----------+---------+----------+--------------+-------------
|
||||
c1 | integer | | not null | | plain | |
|
||||
c2 | text | | | | extended | |
|
||||
c3 | date | | | | plain | |
|
||||
Child tables: ft2
|
||||
|
||||
\d+ ft2
|
||||
Foreign table "public.ft2"
|
||||
Column | Type | Modifiers | FDW Options | Storage | Stats target | Description
|
||||
--------+---------+-----------+-------------+----------+--------------+-------------
|
||||
c1 | integer | not null | | plain | |
|
||||
c2 | text | | | extended | |
|
||||
c3 | date | | | plain | |
|
||||
Foreign table "public.ft2"
|
||||
Column | Type | Collation | Nullable | Default | FDW Options | Storage | Stats target | Description
|
||||
--------+---------+-----------+----------+---------+-------------+----------+--------------+-------------
|
||||
c1 | integer | | not null | | | plain | |
|
||||
c2 | text | | | | | extended | |
|
||||
c3 | date | | | | | plain | |
|
||||
Server: s0
|
||||
FDW Options: (delimiter ',', quote '"', "be quoted" 'value')
|
||||
Inherits: pt1
|
||||
|
||||
DROP FOREIGN TABLE ft2;
|
||||
\d+ pt1
|
||||
Table "public.pt1"
|
||||
Column | Type | Modifiers | Storage | Stats target | Description
|
||||
--------+---------+-----------+----------+--------------+-------------
|
||||
c1 | integer | not null | plain | |
|
||||
c2 | text | | extended | |
|
||||
c3 | date | | plain | |
|
||||
Table "public.pt1"
|
||||
Column | Type | Collation | Nullable | Default | Storage | Stats target | Description
|
||||
--------+---------+-----------+----------+---------+----------+--------------+-------------
|
||||
c1 | integer | | not null | | plain | |
|
||||
c2 | text | | | | extended | |
|
||||
c3 | date | | | | plain | |
|
||||
|
||||
CREATE FOREIGN TABLE ft2 (
|
||||
c1 integer NOT NULL,
|
||||
@ -1275,32 +1275,32 @@ CREATE FOREIGN TABLE ft2 (
|
||||
c3 date
|
||||
) SERVER s0 OPTIONS (delimiter ',', quote '"', "be quoted" 'value');
|
||||
\d+ ft2
|
||||
Foreign table "public.ft2"
|
||||
Column | Type | Modifiers | FDW Options | Storage | Stats target | Description
|
||||
--------+---------+-----------+-------------+----------+--------------+-------------
|
||||
c1 | integer | not null | | plain | |
|
||||
c2 | text | | | extended | |
|
||||
c3 | date | | | plain | |
|
||||
Foreign table "public.ft2"
|
||||
Column | Type | Collation | Nullable | Default | FDW Options | Storage | Stats target | Description
|
||||
--------+---------+-----------+----------+---------+-------------+----------+--------------+-------------
|
||||
c1 | integer | | not null | | | plain | |
|
||||
c2 | text | | | | | extended | |
|
||||
c3 | date | | | | | plain | |
|
||||
Server: s0
|
||||
FDW Options: (delimiter ',', quote '"', "be quoted" 'value')
|
||||
|
||||
ALTER FOREIGN TABLE ft2 INHERIT pt1;
|
||||
\d+ pt1
|
||||
Table "public.pt1"
|
||||
Column | Type | Modifiers | Storage | Stats target | Description
|
||||
--------+---------+-----------+----------+--------------+-------------
|
||||
c1 | integer | not null | plain | |
|
||||
c2 | text | | extended | |
|
||||
c3 | date | | plain | |
|
||||
Table "public.pt1"
|
||||
Column | Type | Collation | Nullable | Default | Storage | Stats target | Description
|
||||
--------+---------+-----------+----------+---------+----------+--------------+-------------
|
||||
c1 | integer | | not null | | plain | |
|
||||
c2 | text | | | | extended | |
|
||||
c3 | date | | | | plain | |
|
||||
Child tables: ft2
|
||||
|
||||
\d+ ft2
|
||||
Foreign table "public.ft2"
|
||||
Column | Type | Modifiers | FDW Options | Storage | Stats target | Description
|
||||
--------+---------+-----------+-------------+----------+--------------+-------------
|
||||
c1 | integer | not null | | plain | |
|
||||
c2 | text | | | extended | |
|
||||
c3 | date | | | plain | |
|
||||
Foreign table "public.ft2"
|
||||
Column | Type | Collation | Nullable | Default | FDW Options | Storage | Stats target | Description
|
||||
--------+---------+-----------+----------+---------+-------------+----------+--------------+-------------
|
||||
c1 | integer | | not null | | | plain | |
|
||||
c2 | text | | | | | extended | |
|
||||
c3 | date | | | | | plain | |
|
||||
Server: s0
|
||||
FDW Options: (delimiter ',', quote '"', "be quoted" 'value')
|
||||
Inherits: pt1
|
||||
@ -1316,12 +1316,12 @@ NOTICE: merging column "c1" with inherited definition
|
||||
NOTICE: merging column "c2" with inherited definition
|
||||
NOTICE: merging column "c3" with inherited definition
|
||||
\d+ ft2
|
||||
Foreign table "public.ft2"
|
||||
Column | Type | Modifiers | FDW Options | Storage | Stats target | Description
|
||||
--------+---------+-----------+-------------+----------+--------------+-------------
|
||||
c1 | integer | not null | | plain | |
|
||||
c2 | text | | | extended | |
|
||||
c3 | date | | | plain | |
|
||||
Foreign table "public.ft2"
|
||||
Column | Type | Collation | Nullable | Default | FDW Options | Storage | Stats target | Description
|
||||
--------+---------+-----------+----------+---------+-------------+----------+--------------+-------------
|
||||
c1 | integer | | not null | | | plain | |
|
||||
c2 | text | | | | | extended | |
|
||||
c3 | date | | | | | plain | |
|
||||
Server: s0
|
||||
FDW Options: (delimiter ',', quote '"', "be quoted" 'value')
|
||||
Inherits: pt1
|
||||
@ -1329,21 +1329,21 @@ Child tables: ct3,
|
||||
ft3
|
||||
|
||||
\d+ ct3
|
||||
Table "public.ct3"
|
||||
Column | Type | Modifiers | Storage | Stats target | Description
|
||||
--------+---------+-----------+----------+--------------+-------------
|
||||
c1 | integer | not null | plain | |
|
||||
c2 | text | | extended | |
|
||||
c3 | date | | plain | |
|
||||
Table "public.ct3"
|
||||
Column | Type | Collation | Nullable | Default | Storage | Stats target | Description
|
||||
--------+---------+-----------+----------+---------+----------+--------------+-------------
|
||||
c1 | integer | | not null | | plain | |
|
||||
c2 | text | | | | extended | |
|
||||
c3 | date | | | | plain | |
|
||||
Inherits: ft2
|
||||
|
||||
\d+ ft3
|
||||
Foreign table "public.ft3"
|
||||
Column | Type | Modifiers | FDW Options | Storage | Stats target | Description
|
||||
--------+---------+-----------+-------------+----------+--------------+-------------
|
||||
c1 | integer | not null | | plain | |
|
||||
c2 | text | | | extended | |
|
||||
c3 | date | | | plain | |
|
||||
Foreign table "public.ft3"
|
||||
Column | Type | Collation | Nullable | Default | FDW Options | Storage | Stats target | Description
|
||||
--------+---------+-----------+----------+---------+-------------+----------+--------------+-------------
|
||||
c1 | integer | | not null | | | plain | |
|
||||
c2 | text | | | | | extended | |
|
||||
c3 | date | | | | | plain | |
|
||||
Server: s0
|
||||
Inherits: ft2
|
||||
|
||||
@ -1354,31 +1354,31 @@ ALTER TABLE pt1 ADD COLUMN c6 integer;
|
||||
ALTER TABLE pt1 ADD COLUMN c7 integer NOT NULL;
|
||||
ALTER TABLE pt1 ADD COLUMN c8 integer;
|
||||
\d+ pt1
|
||||
Table "public.pt1"
|
||||
Column | Type | Modifiers | Storage | Stats target | Description
|
||||
--------+---------+-----------+----------+--------------+-------------
|
||||
c1 | integer | not null | plain | |
|
||||
c2 | text | | extended | |
|
||||
c3 | date | | plain | |
|
||||
c4 | integer | | plain | |
|
||||
c5 | integer | default 0 | plain | |
|
||||
c6 | integer | | plain | |
|
||||
c7 | integer | not null | plain | |
|
||||
c8 | integer | | plain | |
|
||||
Table "public.pt1"
|
||||
Column | Type | Collation | Nullable | Default | Storage | Stats target | Description
|
||||
--------+---------+-----------+----------+---------+----------+--------------+-------------
|
||||
c1 | integer | | not null | | plain | |
|
||||
c2 | text | | | | extended | |
|
||||
c3 | date | | | | plain | |
|
||||
c4 | integer | | | | plain | |
|
||||
c5 | integer | | | 0 | plain | |
|
||||
c6 | integer | | | | plain | |
|
||||
c7 | integer | | not null | | plain | |
|
||||
c8 | integer | | | | plain | |
|
||||
Child tables: ft2
|
||||
|
||||
\d+ ft2
|
||||
Foreign table "public.ft2"
|
||||
Column | Type | Modifiers | FDW Options | Storage | Stats target | Description
|
||||
--------+---------+-----------+-------------+----------+--------------+-------------
|
||||
c1 | integer | not null | | plain | |
|
||||
c2 | text | | | extended | |
|
||||
c3 | date | | | plain | |
|
||||
c4 | integer | | | plain | |
|
||||
c5 | integer | default 0 | | plain | |
|
||||
c6 | integer | | | plain | |
|
||||
c7 | integer | not null | | plain | |
|
||||
c8 | integer | | | plain | |
|
||||
Foreign table "public.ft2"
|
||||
Column | Type | Collation | Nullable | Default | FDW Options | Storage | Stats target | Description
|
||||
--------+---------+-----------+----------+---------+-------------+----------+--------------+-------------
|
||||
c1 | integer | | not null | | | plain | |
|
||||
c2 | text | | | | | extended | |
|
||||
c3 | date | | | | | plain | |
|
||||
c4 | integer | | | | | plain | |
|
||||
c5 | integer | | | 0 | | plain | |
|
||||
c6 | integer | | | | | plain | |
|
||||
c7 | integer | | not null | | | plain | |
|
||||
c8 | integer | | | | | plain | |
|
||||
Server: s0
|
||||
FDW Options: (delimiter ',', quote '"', "be quoted" 'value')
|
||||
Inherits: pt1
|
||||
@ -1386,31 +1386,31 @@ Child tables: ct3,
|
||||
ft3
|
||||
|
||||
\d+ ct3
|
||||
Table "public.ct3"
|
||||
Column | Type | Modifiers | Storage | Stats target | Description
|
||||
--------+---------+-----------+----------+--------------+-------------
|
||||
c1 | integer | not null | plain | |
|
||||
c2 | text | | extended | |
|
||||
c3 | date | | plain | |
|
||||
c4 | integer | | plain | |
|
||||
c5 | integer | default 0 | plain | |
|
||||
c6 | integer | | plain | |
|
||||
c7 | integer | not null | plain | |
|
||||
c8 | integer | | plain | |
|
||||
Table "public.ct3"
|
||||
Column | Type | Collation | Nullable | Default | Storage | Stats target | Description
|
||||
--------+---------+-----------+----------+---------+----------+--------------+-------------
|
||||
c1 | integer | | not null | | plain | |
|
||||
c2 | text | | | | extended | |
|
||||
c3 | date | | | | plain | |
|
||||
c4 | integer | | | | plain | |
|
||||
c5 | integer | | | 0 | plain | |
|
||||
c6 | integer | | | | plain | |
|
||||
c7 | integer | | not null | | plain | |
|
||||
c8 | integer | | | | plain | |
|
||||
Inherits: ft2
|
||||
|
||||
\d+ ft3
|
||||
Foreign table "public.ft3"
|
||||
Column | Type | Modifiers | FDW Options | Storage | Stats target | Description
|
||||
--------+---------+-----------+-------------+----------+--------------+-------------
|
||||
c1 | integer | not null | | plain | |
|
||||
c2 | text | | | extended | |
|
||||
c3 | date | | | plain | |
|
||||
c4 | integer | | | plain | |
|
||||
c5 | integer | default 0 | | plain | |
|
||||
c6 | integer | | | plain | |
|
||||
c7 | integer | not null | | plain | |
|
||||
c8 | integer | | | plain | |
|
||||
Foreign table "public.ft3"
|
||||
Column | Type | Collation | Nullable | Default | FDW Options | Storage | Stats target | Description
|
||||
--------+---------+-----------+----------+---------+-------------+----------+--------------+-------------
|
||||
c1 | integer | | not null | | | plain | |
|
||||
c2 | text | | | | | extended | |
|
||||
c3 | date | | | | | plain | |
|
||||
c4 | integer | | | | | plain | |
|
||||
c5 | integer | | | 0 | | plain | |
|
||||
c6 | integer | | | | | plain | |
|
||||
c7 | integer | | not null | | | plain | |
|
||||
c8 | integer | | | | | plain | |
|
||||
Server: s0
|
||||
Inherits: ft2
|
||||
|
||||
@ -1428,31 +1428,31 @@ ALTER TABLE pt1 ALTER COLUMN c1 SET (n_distinct = 100);
|
||||
ALTER TABLE pt1 ALTER COLUMN c8 SET STATISTICS -1;
|
||||
ALTER TABLE pt1 ALTER COLUMN c8 SET STORAGE EXTERNAL;
|
||||
\d+ pt1
|
||||
Table "public.pt1"
|
||||
Column | Type | Modifiers | Storage | Stats target | Description
|
||||
--------+---------+-----------+----------+--------------+-------------
|
||||
c1 | integer | not null | plain | 10000 |
|
||||
c2 | text | | extended | |
|
||||
c3 | date | | plain | |
|
||||
c4 | integer | default 0 | plain | |
|
||||
c5 | integer | | plain | |
|
||||
c6 | integer | not null | plain | |
|
||||
c7 | integer | | plain | |
|
||||
c8 | text | | external | |
|
||||
Table "public.pt1"
|
||||
Column | Type | Collation | Nullable | Default | Storage | Stats target | Description
|
||||
--------+---------+-----------+----------+---------+----------+--------------+-------------
|
||||
c1 | integer | | not null | | plain | 10000 |
|
||||
c2 | text | | | | extended | |
|
||||
c3 | date | | | | plain | |
|
||||
c4 | integer | | | 0 | plain | |
|
||||
c5 | integer | | | | plain | |
|
||||
c6 | integer | | not null | | plain | |
|
||||
c7 | integer | | | | plain | |
|
||||
c8 | text | | | | external | |
|
||||
Child tables: ft2
|
||||
|
||||
\d+ ft2
|
||||
Foreign table "public.ft2"
|
||||
Column | Type | Modifiers | FDW Options | Storage | Stats target | Description
|
||||
--------+---------+-----------+-------------+----------+--------------+-------------
|
||||
c1 | integer | not null | | plain | 10000 |
|
||||
c2 | text | | | extended | |
|
||||
c3 | date | | | plain | |
|
||||
c4 | integer | default 0 | | plain | |
|
||||
c5 | integer | | | plain | |
|
||||
c6 | integer | not null | | plain | |
|
||||
c7 | integer | | | plain | |
|
||||
c8 | text | | | external | |
|
||||
Foreign table "public.ft2"
|
||||
Column | Type | Collation | Nullable | Default | FDW Options | Storage | Stats target | Description
|
||||
--------+---------+-----------+----------+---------+-------------+----------+--------------+-------------
|
||||
c1 | integer | | not null | | | plain | 10000 |
|
||||
c2 | text | | | | | extended | |
|
||||
c3 | date | | | | | plain | |
|
||||
c4 | integer | | | 0 | | plain | |
|
||||
c5 | integer | | | | | plain | |
|
||||
c6 | integer | | not null | | | plain | |
|
||||
c7 | integer | | | | | plain | |
|
||||
c8 | text | | | | | external | |
|
||||
Server: s0
|
||||
FDW Options: (delimiter ',', quote '"', "be quoted" 'value')
|
||||
Inherits: pt1
|
||||
@ -1466,21 +1466,21 @@ ALTER TABLE pt1 DROP COLUMN c6;
|
||||
ALTER TABLE pt1 DROP COLUMN c7;
|
||||
ALTER TABLE pt1 DROP COLUMN c8;
|
||||
\d+ pt1
|
||||
Table "public.pt1"
|
||||
Column | Type | Modifiers | Storage | Stats target | Description
|
||||
--------+---------+-----------+----------+--------------+-------------
|
||||
c1 | integer | not null | plain | 10000 |
|
||||
c2 | text | | extended | |
|
||||
c3 | date | | plain | |
|
||||
Table "public.pt1"
|
||||
Column | Type | Collation | Nullable | Default | Storage | Stats target | Description
|
||||
--------+---------+-----------+----------+---------+----------+--------------+-------------
|
||||
c1 | integer | | not null | | plain | 10000 |
|
||||
c2 | text | | | | extended | |
|
||||
c3 | date | | | | plain | |
|
||||
Child tables: ft2
|
||||
|
||||
\d+ ft2
|
||||
Foreign table "public.ft2"
|
||||
Column | Type | Modifiers | FDW Options | Storage | Stats target | Description
|
||||
--------+---------+-----------+-------------+----------+--------------+-------------
|
||||
c1 | integer | not null | | plain | 10000 |
|
||||
c2 | text | | | extended | |
|
||||
c3 | date | | | plain | |
|
||||
Foreign table "public.ft2"
|
||||
Column | Type | Collation | Nullable | Default | FDW Options | Storage | Stats target | Description
|
||||
--------+---------+-----------+----------+---------+-------------+----------+--------------+-------------
|
||||
c1 | integer | | not null | | | plain | 10000 |
|
||||
c2 | text | | | | | extended | |
|
||||
c3 | date | | | | | plain | |
|
||||
Server: s0
|
||||
FDW Options: (delimiter ',', quote '"', "be quoted" 'value')
|
||||
Inherits: pt1
|
||||
@ -1503,24 +1503,24 @@ SELECT relname, conname, contype, conislocal, coninhcount, connoinherit
|
||||
|
||||
-- child does not inherit NO INHERIT constraints
|
||||
\d+ pt1
|
||||
Table "public.pt1"
|
||||
Column | Type | Modifiers | Storage | Stats target | Description
|
||||
--------+---------+-----------+----------+--------------+-------------
|
||||
c1 | integer | not null | plain | 10000 |
|
||||
c2 | text | | extended | |
|
||||
c3 | date | | plain | |
|
||||
Table "public.pt1"
|
||||
Column | Type | Collation | Nullable | Default | Storage | Stats target | Description
|
||||
--------+---------+-----------+----------+---------+----------+--------------+-------------
|
||||
c1 | integer | | not null | | plain | 10000 |
|
||||
c2 | text | | | | extended | |
|
||||
c3 | date | | | | plain | |
|
||||
Check constraints:
|
||||
"pt1chk1" CHECK (c1 > 0) NO INHERIT
|
||||
"pt1chk2" CHECK (c2 <> ''::text)
|
||||
Child tables: ft2
|
||||
|
||||
\d+ ft2
|
||||
Foreign table "public.ft2"
|
||||
Column | Type | Modifiers | FDW Options | Storage | Stats target | Description
|
||||
--------+---------+-----------+-------------+----------+--------------+-------------
|
||||
c1 | integer | not null | | plain | 10000 |
|
||||
c2 | text | | | extended | |
|
||||
c3 | date | | | plain | |
|
||||
Foreign table "public.ft2"
|
||||
Column | Type | Collation | Nullable | Default | FDW Options | Storage | Stats target | Description
|
||||
--------+---------+-----------+----------+---------+-------------+----------+--------------+-------------
|
||||
c1 | integer | | not null | | | plain | 10000 |
|
||||
c2 | text | | | | | extended | |
|
||||
c3 | date | | | | | plain | |
|
||||
Check constraints:
|
||||
"pt1chk2" CHECK (c2 <> ''::text)
|
||||
Server: s0
|
||||
@ -1550,24 +1550,24 @@ ALTER FOREIGN TABLE ft2 ADD CONSTRAINT pt1chk2 CHECK (c2 <> '');
|
||||
ALTER FOREIGN TABLE ft2 INHERIT pt1;
|
||||
-- child does not inherit NO INHERIT constraints
|
||||
\d+ pt1
|
||||
Table "public.pt1"
|
||||
Column | Type | Modifiers | Storage | Stats target | Description
|
||||
--------+---------+-----------+----------+--------------+-------------
|
||||
c1 | integer | not null | plain | 10000 |
|
||||
c2 | text | | extended | |
|
||||
c3 | date | | plain | |
|
||||
Table "public.pt1"
|
||||
Column | Type | Collation | Nullable | Default | Storage | Stats target | Description
|
||||
--------+---------+-----------+----------+---------+----------+--------------+-------------
|
||||
c1 | integer | | not null | | plain | 10000 |
|
||||
c2 | text | | | | extended | |
|
||||
c3 | date | | | | plain | |
|
||||
Check constraints:
|
||||
"pt1chk1" CHECK (c1 > 0) NO INHERIT
|
||||
"pt1chk2" CHECK (c2 <> ''::text)
|
||||
Child tables: ft2
|
||||
|
||||
\d+ ft2
|
||||
Foreign table "public.ft2"
|
||||
Column | Type | Modifiers | FDW Options | Storage | Stats target | Description
|
||||
--------+---------+-----------+-------------+----------+--------------+-------------
|
||||
c1 | integer | not null | | plain | |
|
||||
c2 | text | | | extended | |
|
||||
c3 | date | | | plain | |
|
||||
Foreign table "public.ft2"
|
||||
Column | Type | Collation | Nullable | Default | FDW Options | Storage | Stats target | Description
|
||||
--------+---------+-----------+----------+---------+-------------+----------+--------------+-------------
|
||||
c1 | integer | | not null | | | plain | |
|
||||
c2 | text | | | | | extended | |
|
||||
c3 | date | | | | | plain | |
|
||||
Check constraints:
|
||||
"pt1chk2" CHECK (c2 <> ''::text)
|
||||
Server: s0
|
||||
@ -1581,23 +1581,23 @@ ALTER TABLE pt1 DROP CONSTRAINT pt1chk2 CASCADE;
|
||||
INSERT INTO pt1 VALUES (1, 'pt1'::text, '1994-01-01'::date);
|
||||
ALTER TABLE pt1 ADD CONSTRAINT pt1chk3 CHECK (c2 <> '') NOT VALID;
|
||||
\d+ pt1
|
||||
Table "public.pt1"
|
||||
Column | Type | Modifiers | Storage | Stats target | Description
|
||||
--------+---------+-----------+----------+--------------+-------------
|
||||
c1 | integer | not null | plain | 10000 |
|
||||
c2 | text | | extended | |
|
||||
c3 | date | | plain | |
|
||||
Table "public.pt1"
|
||||
Column | Type | Collation | Nullable | Default | Storage | Stats target | Description
|
||||
--------+---------+-----------+----------+---------+----------+--------------+-------------
|
||||
c1 | integer | | not null | | plain | 10000 |
|
||||
c2 | text | | | | extended | |
|
||||
c3 | date | | | | plain | |
|
||||
Check constraints:
|
||||
"pt1chk3" CHECK (c2 <> ''::text) NOT VALID
|
||||
Child tables: ft2
|
||||
|
||||
\d+ ft2
|
||||
Foreign table "public.ft2"
|
||||
Column | Type | Modifiers | FDW Options | Storage | Stats target | Description
|
||||
--------+---------+-----------+-------------+----------+--------------+-------------
|
||||
c1 | integer | not null | | plain | |
|
||||
c2 | text | | | extended | |
|
||||
c3 | date | | | plain | |
|
||||
Foreign table "public.ft2"
|
||||
Column | Type | Collation | Nullable | Default | FDW Options | Storage | Stats target | Description
|
||||
--------+---------+-----------+----------+---------+-------------+----------+--------------+-------------
|
||||
c1 | integer | | not null | | | plain | |
|
||||
c2 | text | | | | | extended | |
|
||||
c3 | date | | | | | plain | |
|
||||
Check constraints:
|
||||
"pt1chk2" CHECK (c2 <> ''::text)
|
||||
"pt1chk3" CHECK (c2 <> ''::text) NOT VALID
|
||||
@ -1608,23 +1608,23 @@ Inherits: pt1
|
||||
-- VALIDATE CONSTRAINT need do nothing on foreign tables
|
||||
ALTER TABLE pt1 VALIDATE CONSTRAINT pt1chk3;
|
||||
\d+ pt1
|
||||
Table "public.pt1"
|
||||
Column | Type | Modifiers | Storage | Stats target | Description
|
||||
--------+---------+-----------+----------+--------------+-------------
|
||||
c1 | integer | not null | plain | 10000 |
|
||||
c2 | text | | extended | |
|
||||
c3 | date | | plain | |
|
||||
Table "public.pt1"
|
||||
Column | Type | Collation | Nullable | Default | Storage | Stats target | Description
|
||||
--------+---------+-----------+----------+---------+----------+--------------+-------------
|
||||
c1 | integer | | not null | | plain | 10000 |
|
||||
c2 | text | | | | extended | |
|
||||
c3 | date | | | | plain | |
|
||||
Check constraints:
|
||||
"pt1chk3" CHECK (c2 <> ''::text)
|
||||
Child tables: ft2
|
||||
|
||||
\d+ ft2
|
||||
Foreign table "public.ft2"
|
||||
Column | Type | Modifiers | FDW Options | Storage | Stats target | Description
|
||||
--------+---------+-----------+-------------+----------+--------------+-------------
|
||||
c1 | integer | not null | | plain | |
|
||||
c2 | text | | | extended | |
|
||||
c3 | date | | | plain | |
|
||||
Foreign table "public.ft2"
|
||||
Column | Type | Collation | Nullable | Default | FDW Options | Storage | Stats target | Description
|
||||
--------+---------+-----------+----------+---------+-------------+----------+--------------+-------------
|
||||
c1 | integer | | not null | | | plain | |
|
||||
c2 | text | | | | | extended | |
|
||||
c3 | date | | | | | plain | |
|
||||
Check constraints:
|
||||
"pt1chk2" CHECK (c2 <> ''::text)
|
||||
"pt1chk3" CHECK (c2 <> ''::text)
|
||||
@ -1635,24 +1635,24 @@ Inherits: pt1
|
||||
-- OID system column
|
||||
ALTER TABLE pt1 SET WITH OIDS;
|
||||
\d+ pt1
|
||||
Table "public.pt1"
|
||||
Column | Type | Modifiers | Storage | Stats target | Description
|
||||
--------+---------+-----------+----------+--------------+-------------
|
||||
c1 | integer | not null | plain | 10000 |
|
||||
c2 | text | | extended | |
|
||||
c3 | date | | plain | |
|
||||
Table "public.pt1"
|
||||
Column | Type | Collation | Nullable | Default | Storage | Stats target | Description
|
||||
--------+---------+-----------+----------+---------+----------+--------------+-------------
|
||||
c1 | integer | | not null | | plain | 10000 |
|
||||
c2 | text | | | | extended | |
|
||||
c3 | date | | | | plain | |
|
||||
Check constraints:
|
||||
"pt1chk3" CHECK (c2 <> ''::text)
|
||||
Child tables: ft2
|
||||
Has OIDs: yes
|
||||
|
||||
\d+ ft2
|
||||
Foreign table "public.ft2"
|
||||
Column | Type | Modifiers | FDW Options | Storage | Stats target | Description
|
||||
--------+---------+-----------+-------------+----------+--------------+-------------
|
||||
c1 | integer | not null | | plain | |
|
||||
c2 | text | | | extended | |
|
||||
c3 | date | | | plain | |
|
||||
Foreign table "public.ft2"
|
||||
Column | Type | Collation | Nullable | Default | FDW Options | Storage | Stats target | Description
|
||||
--------+---------+-----------+----------+---------+-------------+----------+--------------+-------------
|
||||
c1 | integer | | not null | | | plain | |
|
||||
c2 | text | | | | | extended | |
|
||||
c3 | date | | | | | plain | |
|
||||
Check constraints:
|
||||
"pt1chk2" CHECK (c2 <> ''::text)
|
||||
"pt1chk3" CHECK (c2 <> ''::text)
|
||||
@ -1665,23 +1665,23 @@ ALTER TABLE ft2 SET WITHOUT OIDS; -- ERROR
|
||||
ERROR: cannot drop inherited column "oid"
|
||||
ALTER TABLE pt1 SET WITHOUT OIDS;
|
||||
\d+ pt1
|
||||
Table "public.pt1"
|
||||
Column | Type | Modifiers | Storage | Stats target | Description
|
||||
--------+---------+-----------+----------+--------------+-------------
|
||||
c1 | integer | not null | plain | 10000 |
|
||||
c2 | text | | extended | |
|
||||
c3 | date | | plain | |
|
||||
Table "public.pt1"
|
||||
Column | Type | Collation | Nullable | Default | Storage | Stats target | Description
|
||||
--------+---------+-----------+----------+---------+----------+--------------+-------------
|
||||
c1 | integer | | not null | | plain | 10000 |
|
||||
c2 | text | | | | extended | |
|
||||
c3 | date | | | | plain | |
|
||||
Check constraints:
|
||||
"pt1chk3" CHECK (c2 <> ''::text)
|
||||
Child tables: ft2
|
||||
|
||||
\d+ ft2
|
||||
Foreign table "public.ft2"
|
||||
Column | Type | Modifiers | FDW Options | Storage | Stats target | Description
|
||||
--------+---------+-----------+-------------+----------+--------------+-------------
|
||||
c1 | integer | not null | | plain | |
|
||||
c2 | text | | | extended | |
|
||||
c3 | date | | | plain | |
|
||||
Foreign table "public.ft2"
|
||||
Column | Type | Collation | Nullable | Default | FDW Options | Storage | Stats target | Description
|
||||
--------+---------+-----------+----------+---------+-------------+----------+--------------+-------------
|
||||
c1 | integer | | not null | | | plain | |
|
||||
c2 | text | | | | | extended | |
|
||||
c3 | date | | | | | plain | |
|
||||
Check constraints:
|
||||
"pt1chk2" CHECK (c2 <> ''::text)
|
||||
"pt1chk3" CHECK (c2 <> ''::text)
|
||||
@ -1696,23 +1696,23 @@ ALTER TABLE pt1 RENAME COLUMN c3 TO f3;
|
||||
-- changes name of a constraint recursively
|
||||
ALTER TABLE pt1 RENAME CONSTRAINT pt1chk3 TO f2_check;
|
||||
\d+ pt1
|
||||
Table "public.pt1"
|
||||
Column | Type | Modifiers | Storage | Stats target | Description
|
||||
--------+---------+-----------+----------+--------------+-------------
|
||||
f1 | integer | not null | plain | 10000 |
|
||||
f2 | text | | extended | |
|
||||
f3 | date | | plain | |
|
||||
Table "public.pt1"
|
||||
Column | Type | Collation | Nullable | Default | Storage | Stats target | Description
|
||||
--------+---------+-----------+----------+---------+----------+--------------+-------------
|
||||
f1 | integer | | not null | | plain | 10000 |
|
||||
f2 | text | | | | extended | |
|
||||
f3 | date | | | | plain | |
|
||||
Check constraints:
|
||||
"f2_check" CHECK (f2 <> ''::text)
|
||||
Child tables: ft2
|
||||
|
||||
\d+ ft2
|
||||
Foreign table "public.ft2"
|
||||
Column | Type | Modifiers | FDW Options | Storage | Stats target | Description
|
||||
--------+---------+-----------+-------------+----------+--------------+-------------
|
||||
f1 | integer | not null | | plain | |
|
||||
f2 | text | | | extended | |
|
||||
f3 | date | | | plain | |
|
||||
Foreign table "public.ft2"
|
||||
Column | Type | Collation | Nullable | Default | FDW Options | Storage | Stats target | Description
|
||||
--------+---------+-----------+----------+---------+-------------+----------+--------------+-------------
|
||||
f1 | integer | | not null | | | plain | |
|
||||
f2 | text | | | | | extended | |
|
||||
f3 | date | | | | | plain | |
|
||||
Check constraints:
|
||||
"f2_check" CHECK (f2 <> ''::text)
|
||||
"pt1chk2" CHECK (f2 <> ''::text)
|
||||
|
@ -627,20 +627,20 @@ select pc.relname, pgc.conname, pgc.contype, pgc.conislocal, pgc.coninhcount, pg
|
||||
-- Test that child does not inherit NO INHERIT constraints
|
||||
create table c1 () inherits (p1);
|
||||
\d p1
|
||||
Table "public.p1"
|
||||
Column | Type | Modifiers
|
||||
--------+---------+-----------
|
||||
ff1 | integer |
|
||||
Table "public.p1"
|
||||
Column | Type | Collation | Nullable | Default
|
||||
--------+---------+-----------+----------+---------
|
||||
ff1 | integer | | |
|
||||
Check constraints:
|
||||
"p1chk" CHECK (ff1 > 0) NO INHERIT
|
||||
"p2chk" CHECK (ff1 > 10)
|
||||
Number of child tables: 1 (Use \d+ to list them.)
|
||||
|
||||
\d c1
|
||||
Table "public.c1"
|
||||
Column | Type | Modifiers
|
||||
--------+---------+-----------
|
||||
ff1 | integer |
|
||||
Table "public.c1"
|
||||
Column | Type | Collation | Nullable | Default
|
||||
--------+---------+-----------+----------+---------
|
||||
ff1 | integer | | |
|
||||
Check constraints:
|
||||
"p2chk" CHECK (ff1 > 10)
|
||||
Inherits: p1
|
||||
@ -806,12 +806,12 @@ ERROR: new row for relation "c1" violates check constraint "p2_f2_check"
|
||||
DETAIL: Failing row contains (1, -1, 2).
|
||||
create table c2(f3 int) inherits(p1,p2);
|
||||
\d c2
|
||||
Table "public.c2"
|
||||
Column | Type | Modifiers
|
||||
--------+---------+-----------
|
||||
f1 | integer |
|
||||
f2 | integer |
|
||||
f3 | integer |
|
||||
Table "public.c2"
|
||||
Column | Type | Collation | Nullable | Default
|
||||
--------+---------+-----------+----------+---------
|
||||
f1 | integer | | |
|
||||
f2 | integer | | |
|
||||
f3 | integer | | |
|
||||
Check constraints:
|
||||
"p2_f2_check" CHECK (f2 > 0)
|
||||
Inherits: p1,
|
||||
@ -822,13 +822,13 @@ NOTICE: merging multiple inherited definitions of column "f1"
|
||||
NOTICE: merging multiple inherited definitions of column "f2"
|
||||
NOTICE: merging multiple inherited definitions of column "f3"
|
||||
\d c3
|
||||
Table "public.c3"
|
||||
Column | Type | Modifiers
|
||||
--------+---------+-----------
|
||||
f1 | integer |
|
||||
f2 | integer |
|
||||
f3 | integer |
|
||||
f4 | integer |
|
||||
Table "public.c3"
|
||||
Column | Type | Collation | Nullable | Default
|
||||
--------+---------+-----------+----------+---------
|
||||
f1 | integer | | |
|
||||
f2 | integer | | |
|
||||
f3 | integer | | |
|
||||
f4 | integer | | |
|
||||
Check constraints:
|
||||
"p2_f2_check" CHECK (f2 > 0)
|
||||
Inherits: c1,
|
||||
@ -844,13 +844,13 @@ create table pp1 (f1 int);
|
||||
create table cc1 (f2 text, f3 int) inherits (pp1);
|
||||
alter table pp1 add column a1 int check (a1 > 0);
|
||||
\d cc1
|
||||
Table "public.cc1"
|
||||
Column | Type | Modifiers
|
||||
--------+---------+-----------
|
||||
f1 | integer |
|
||||
f2 | text |
|
||||
f3 | integer |
|
||||
a1 | integer |
|
||||
Table "public.cc1"
|
||||
Column | Type | Collation | Nullable | Default
|
||||
--------+---------+-----------+----------+---------
|
||||
f1 | integer | | |
|
||||
f2 | text | | |
|
||||
f3 | integer | | |
|
||||
a1 | integer | | |
|
||||
Check constraints:
|
||||
"pp1_a1_check" CHECK (a1 > 0)
|
||||
Inherits: pp1
|
||||
@ -859,14 +859,14 @@ create table cc2(f4 float) inherits(pp1,cc1);
|
||||
NOTICE: merging multiple inherited definitions of column "f1"
|
||||
NOTICE: merging multiple inherited definitions of column "a1"
|
||||
\d cc2
|
||||
Table "public.cc2"
|
||||
Column | Type | Modifiers
|
||||
--------+------------------+-----------
|
||||
f1 | integer |
|
||||
a1 | integer |
|
||||
f2 | text |
|
||||
f3 | integer |
|
||||
f4 | double precision |
|
||||
Table "public.cc2"
|
||||
Column | Type | Collation | Nullable | Default
|
||||
--------+------------------+-----------+----------+---------
|
||||
f1 | integer | | |
|
||||
a1 | integer | | |
|
||||
f2 | text | | |
|
||||
f3 | integer | | |
|
||||
f4 | double precision | | |
|
||||
Check constraints:
|
||||
"pp1_a1_check" CHECK (a1 > 0)
|
||||
Inherits: pp1,
|
||||
@ -876,15 +876,15 @@ alter table pp1 add column a2 int check (a2 > 0);
|
||||
NOTICE: merging definition of column "a2" for child "cc2"
|
||||
NOTICE: merging constraint "pp1_a2_check" with inherited definition
|
||||
\d cc2
|
||||
Table "public.cc2"
|
||||
Column | Type | Modifiers
|
||||
--------+------------------+-----------
|
||||
f1 | integer |
|
||||
a1 | integer |
|
||||
f2 | text |
|
||||
f3 | integer |
|
||||
f4 | double precision |
|
||||
a2 | integer |
|
||||
Table "public.cc2"
|
||||
Column | Type | Collation | Nullable | Default
|
||||
--------+------------------+-----------+----------+---------
|
||||
f1 | integer | | |
|
||||
a1 | integer | | |
|
||||
f2 | text | | |
|
||||
f3 | integer | | |
|
||||
f4 | double precision | | |
|
||||
a2 | integer | | |
|
||||
Check constraints:
|
||||
"pp1_a1_check" CHECK (a1 > 0)
|
||||
"pp1_a2_check" CHECK (a2 > 0)
|
||||
@ -907,13 +907,13 @@ ALTER TABLE inhts RENAME aa TO aaa; -- to be failed
|
||||
ERROR: cannot rename inherited column "aa"
|
||||
ALTER TABLE inhts RENAME d TO dd;
|
||||
\d+ inhts
|
||||
Table "public.inhts"
|
||||
Column | Type | Modifiers | Storage | Stats target | Description
|
||||
--------+---------+-----------+---------+--------------+-------------
|
||||
aa | integer | | plain | |
|
||||
b | integer | | plain | |
|
||||
c | integer | | plain | |
|
||||
dd | integer | | plain | |
|
||||
Table "public.inhts"
|
||||
Column | Type | Collation | Nullable | Default | Storage | Stats target | Description
|
||||
--------+---------+-----------+----------+---------+---------+--------------+-------------
|
||||
aa | integer | | | | plain | |
|
||||
b | integer | | | | plain | |
|
||||
c | integer | | | | plain | |
|
||||
dd | integer | | | | plain | |
|
||||
Inherits: inht1,
|
||||
inhs1
|
||||
|
||||
@ -926,14 +926,14 @@ NOTICE: merging multiple inherited definitions of column "aa"
|
||||
NOTICE: merging multiple inherited definitions of column "b"
|
||||
ALTER TABLE inht1 RENAME aa TO aaa;
|
||||
\d+ inht4
|
||||
Table "public.inht4"
|
||||
Column | Type | Modifiers | Storage | Stats target | Description
|
||||
--------+---------+-----------+---------+--------------+-------------
|
||||
aaa | integer | | plain | |
|
||||
b | integer | | plain | |
|
||||
x | integer | | plain | |
|
||||
y | integer | | plain | |
|
||||
z | integer | | plain | |
|
||||
Table "public.inht4"
|
||||
Column | Type | Collation | Nullable | Default | Storage | Stats target | Description
|
||||
--------+---------+-----------+----------+---------+---------+--------------+-------------
|
||||
aaa | integer | | | | plain | |
|
||||
b | integer | | | | plain | |
|
||||
x | integer | | | | plain | |
|
||||
y | integer | | | | plain | |
|
||||
z | integer | | | | plain | |
|
||||
Inherits: inht2,
|
||||
inht3
|
||||
|
||||
@ -943,14 +943,14 @@ ALTER TABLE inht1 RENAME aaa TO aaaa;
|
||||
ALTER TABLE inht1 RENAME b TO bb; -- to be failed
|
||||
ERROR: cannot rename inherited column "b"
|
||||
\d+ inhts
|
||||
Table "public.inhts"
|
||||
Column | Type | Modifiers | Storage | Stats target | Description
|
||||
--------+---------+-----------+---------+--------------+-------------
|
||||
aaaa | integer | | plain | |
|
||||
b | integer | | plain | |
|
||||
x | integer | | plain | |
|
||||
c | integer | | plain | |
|
||||
d | integer | | plain | |
|
||||
Table "public.inhts"
|
||||
Column | Type | Collation | Nullable | Default | Storage | Stats target | Description
|
||||
--------+---------+-----------+----------+---------+---------+--------------+-------------
|
||||
aaaa | integer | | | | plain | |
|
||||
b | integer | | | | plain | |
|
||||
x | integer | | | | plain | |
|
||||
c | integer | | | | plain | |
|
||||
d | integer | | | | plain | |
|
||||
Inherits: inht2,
|
||||
inhs1
|
||||
|
||||
@ -990,33 +990,33 @@ drop cascades to table inht4
|
||||
CREATE TABLE test_constraints (id int, val1 varchar, val2 int, UNIQUE(val1, val2));
|
||||
CREATE TABLE test_constraints_inh () INHERITS (test_constraints);
|
||||
\d+ test_constraints
|
||||
Table "public.test_constraints"
|
||||
Column | Type | Modifiers | Storage | Stats target | Description
|
||||
--------+-------------------+-----------+----------+--------------+-------------
|
||||
id | integer | | plain | |
|
||||
val1 | character varying | | extended | |
|
||||
val2 | integer | | plain | |
|
||||
Table "public.test_constraints"
|
||||
Column | Type | Collation | Nullable | Default | Storage | Stats target | Description
|
||||
--------+-------------------+-----------+----------+---------+----------+--------------+-------------
|
||||
id | integer | | | | plain | |
|
||||
val1 | character varying | | | | extended | |
|
||||
val2 | integer | | | | plain | |
|
||||
Indexes:
|
||||
"test_constraints_val1_val2_key" UNIQUE CONSTRAINT, btree (val1, val2)
|
||||
Child tables: test_constraints_inh
|
||||
|
||||
ALTER TABLE ONLY test_constraints DROP CONSTRAINT test_constraints_val1_val2_key;
|
||||
\d+ test_constraints
|
||||
Table "public.test_constraints"
|
||||
Column | Type | Modifiers | Storage | Stats target | Description
|
||||
--------+-------------------+-----------+----------+--------------+-------------
|
||||
id | integer | | plain | |
|
||||
val1 | character varying | | extended | |
|
||||
val2 | integer | | plain | |
|
||||
Table "public.test_constraints"
|
||||
Column | Type | Collation | Nullable | Default | Storage | Stats target | Description
|
||||
--------+-------------------+-----------+----------+---------+----------+--------------+-------------
|
||||
id | integer | | | | plain | |
|
||||
val1 | character varying | | | | extended | |
|
||||
val2 | integer | | | | plain | |
|
||||
Child tables: test_constraints_inh
|
||||
|
||||
\d+ test_constraints_inh
|
||||
Table "public.test_constraints_inh"
|
||||
Column | Type | Modifiers | Storage | Stats target | Description
|
||||
--------+-------------------+-----------+----------+--------------+-------------
|
||||
id | integer | | plain | |
|
||||
val1 | character varying | | extended | |
|
||||
val2 | integer | | plain | |
|
||||
Table "public.test_constraints_inh"
|
||||
Column | Type | Collation | Nullable | Default | Storage | Stats target | Description
|
||||
--------+-------------------+-----------+----------+---------+----------+--------------+-------------
|
||||
id | integer | | | | plain | |
|
||||
val1 | character varying | | | | extended | |
|
||||
val2 | integer | | | | plain | |
|
||||
Inherits: test_constraints
|
||||
|
||||
DROP TABLE test_constraints_inh;
|
||||
@ -1027,27 +1027,27 @@ CREATE TABLE test_ex_constraints (
|
||||
);
|
||||
CREATE TABLE test_ex_constraints_inh () INHERITS (test_ex_constraints);
|
||||
\d+ test_ex_constraints
|
||||
Table "public.test_ex_constraints"
|
||||
Column | Type | Modifiers | Storage | Stats target | Description
|
||||
--------+--------+-----------+---------+--------------+-------------
|
||||
c | circle | | plain | |
|
||||
Table "public.test_ex_constraints"
|
||||
Column | Type | Collation | Nullable | Default | Storage | Stats target | Description
|
||||
--------+--------+-----------+----------+---------+---------+--------------+-------------
|
||||
c | circle | | | | plain | |
|
||||
Indexes:
|
||||
"test_ex_constraints_c_excl" EXCLUDE USING gist (c WITH &&)
|
||||
Child tables: test_ex_constraints_inh
|
||||
|
||||
ALTER TABLE test_ex_constraints DROP CONSTRAINT test_ex_constraints_c_excl;
|
||||
\d+ test_ex_constraints
|
||||
Table "public.test_ex_constraints"
|
||||
Column | Type | Modifiers | Storage | Stats target | Description
|
||||
--------+--------+-----------+---------+--------------+-------------
|
||||
c | circle | | plain | |
|
||||
Table "public.test_ex_constraints"
|
||||
Column | Type | Collation | Nullable | Default | Storage | Stats target | Description
|
||||
--------+--------+-----------+----------+---------+---------+--------------+-------------
|
||||
c | circle | | | | plain | |
|
||||
Child tables: test_ex_constraints_inh
|
||||
|
||||
\d+ test_ex_constraints_inh
|
||||
Table "public.test_ex_constraints_inh"
|
||||
Column | Type | Modifiers | Storage | Stats target | Description
|
||||
--------+--------+-----------+---------+--------------+-------------
|
||||
c | circle | | plain | |
|
||||
Table "public.test_ex_constraints_inh"
|
||||
Column | Type | Collation | Nullable | Default | Storage | Stats target | Description
|
||||
--------+--------+-----------+----------+---------+---------+--------------+-------------
|
||||
c | circle | | | | plain | |
|
||||
Inherits: test_ex_constraints
|
||||
|
||||
DROP TABLE test_ex_constraints_inh;
|
||||
@ -1057,37 +1057,37 @@ CREATE TABLE test_primary_constraints(id int PRIMARY KEY);
|
||||
CREATE TABLE test_foreign_constraints(id1 int REFERENCES test_primary_constraints(id));
|
||||
CREATE TABLE test_foreign_constraints_inh () INHERITS (test_foreign_constraints);
|
||||
\d+ test_primary_constraints
|
||||
Table "public.test_primary_constraints"
|
||||
Column | Type | Modifiers | Storage | Stats target | Description
|
||||
--------+---------+-----------+---------+--------------+-------------
|
||||
id | integer | not null | plain | |
|
||||
Table "public.test_primary_constraints"
|
||||
Column | Type | Collation | Nullable | Default | Storage | Stats target | Description
|
||||
--------+---------+-----------+----------+---------+---------+--------------+-------------
|
||||
id | integer | | not null | | plain | |
|
||||
Indexes:
|
||||
"test_primary_constraints_pkey" PRIMARY KEY, btree (id)
|
||||
Referenced by:
|
||||
TABLE "test_foreign_constraints" CONSTRAINT "test_foreign_constraints_id1_fkey" FOREIGN KEY (id1) REFERENCES test_primary_constraints(id)
|
||||
|
||||
\d+ test_foreign_constraints
|
||||
Table "public.test_foreign_constraints"
|
||||
Column | Type | Modifiers | Storage | Stats target | Description
|
||||
--------+---------+-----------+---------+--------------+-------------
|
||||
id1 | integer | | plain | |
|
||||
Table "public.test_foreign_constraints"
|
||||
Column | Type | Collation | Nullable | Default | Storage | Stats target | Description
|
||||
--------+---------+-----------+----------+---------+---------+--------------+-------------
|
||||
id1 | integer | | | | plain | |
|
||||
Foreign-key constraints:
|
||||
"test_foreign_constraints_id1_fkey" FOREIGN KEY (id1) REFERENCES test_primary_constraints(id)
|
||||
Child tables: test_foreign_constraints_inh
|
||||
|
||||
ALTER TABLE test_foreign_constraints DROP CONSTRAINT test_foreign_constraints_id1_fkey;
|
||||
\d+ test_foreign_constraints
|
||||
Table "public.test_foreign_constraints"
|
||||
Column | Type | Modifiers | Storage | Stats target | Description
|
||||
--------+---------+-----------+---------+--------------+-------------
|
||||
id1 | integer | | plain | |
|
||||
Table "public.test_foreign_constraints"
|
||||
Column | Type | Collation | Nullable | Default | Storage | Stats target | Description
|
||||
--------+---------+-----------+----------+---------+---------+--------------+-------------
|
||||
id1 | integer | | | | plain | |
|
||||
Child tables: test_foreign_constraints_inh
|
||||
|
||||
\d+ test_foreign_constraints_inh
|
||||
Table "public.test_foreign_constraints_inh"
|
||||
Column | Type | Modifiers | Storage | Stats target | Description
|
||||
--------+---------+-----------+---------+--------------+-------------
|
||||
id1 | integer | | plain | |
|
||||
Table "public.test_foreign_constraints_inh"
|
||||
Column | Type | Collation | Nullable | Default | Storage | Stats target | Description
|
||||
--------+---------+-----------+----------+---------+---------+--------------+-------------
|
||||
id1 | integer | | | | plain | |
|
||||
Inherits: test_foreign_constraints
|
||||
|
||||
DROP TABLE test_foreign_constraints_inh;
|
||||
|
@ -142,11 +142,11 @@ create rule irule3 as on insert to inserttest2 do also
|
||||
insert into inserttest (f4[1].if1, f4[1].if2[2])
|
||||
select new.f1, new.f2;
|
||||
\d+ inserttest2
|
||||
Table "public.inserttest2"
|
||||
Column | Type | Modifiers | Storage | Stats target | Description
|
||||
--------+--------+-----------+----------+--------------+-------------
|
||||
f1 | bigint | | plain | |
|
||||
f2 | text | | extended | |
|
||||
Table "public.inserttest2"
|
||||
Column | Type | Collation | Nullable | Default | Storage | Stats target | Description
|
||||
--------+--------+-----------+----------+---------+----------+--------------+-------------
|
||||
f1 | bigint | | | | plain | |
|
||||
f2 | text | | | | extended | |
|
||||
Rules:
|
||||
irule1 AS
|
||||
ON INSERT TO inserttest2 DO INSERT INTO inserttest (f3.if2[1], f3.if2[2])
|
||||
|
@ -94,11 +94,11 @@ CREATE MATERIALIZED VIEW mvtest_bb AS SELECT * FROM mvtest_tvvmv;
|
||||
CREATE INDEX mvtest_aa ON mvtest_bb (grandtot);
|
||||
-- check that plans seem reasonable
|
||||
\d+ mvtest_tvm
|
||||
Materialized view "public.mvtest_tvm"
|
||||
Column | Type | Modifiers | Storage | Stats target | Description
|
||||
--------+---------+-----------+----------+--------------+-------------
|
||||
type | text | | extended | |
|
||||
totamt | numeric | | main | |
|
||||
Materialized view "public.mvtest_tvm"
|
||||
Column | Type | Collation | Nullable | Default | Storage | Stats target | Description
|
||||
--------+---------+-----------+----------+---------+----------+--------------+-------------
|
||||
type | text | | | | extended | |
|
||||
totamt | numeric | | | | main | |
|
||||
View definition:
|
||||
SELECT mvtest_tv.type,
|
||||
mvtest_tv.totamt
|
||||
@ -106,11 +106,11 @@ View definition:
|
||||
ORDER BY mvtest_tv.type;
|
||||
|
||||
\d+ mvtest_tvm
|
||||
Materialized view "public.mvtest_tvm"
|
||||
Column | Type | Modifiers | Storage | Stats target | Description
|
||||
--------+---------+-----------+----------+--------------+-------------
|
||||
type | text | | extended | |
|
||||
totamt | numeric | | main | |
|
||||
Materialized view "public.mvtest_tvm"
|
||||
Column | Type | Collation | Nullable | Default | Storage | Stats target | Description
|
||||
--------+---------+-----------+----------+---------+----------+--------------+-------------
|
||||
type | text | | | | extended | |
|
||||
totamt | numeric | | | | main | |
|
||||
View definition:
|
||||
SELECT mvtest_tv.type,
|
||||
mvtest_tv.totamt
|
||||
@ -118,19 +118,19 @@ View definition:
|
||||
ORDER BY mvtest_tv.type;
|
||||
|
||||
\d+ mvtest_tvvm
|
||||
Materialized view "public.mvtest_tvvm"
|
||||
Column | Type | Modifiers | Storage | Stats target | Description
|
||||
----------+---------+-----------+---------+--------------+-------------
|
||||
grandtot | numeric | | main | |
|
||||
Materialized view "public.mvtest_tvvm"
|
||||
Column | Type | Collation | Nullable | Default | Storage | Stats target | Description
|
||||
----------+---------+-----------+----------+---------+---------+--------------+-------------
|
||||
grandtot | numeric | | | | main | |
|
||||
View definition:
|
||||
SELECT mvtest_tvv.grandtot
|
||||
FROM mvtest_tvv;
|
||||
|
||||
\d+ mvtest_bb
|
||||
Materialized view "public.mvtest_bb"
|
||||
Column | Type | Modifiers | Storage | Stats target | Description
|
||||
----------+---------+-----------+---------+--------------+-------------
|
||||
grandtot | numeric | | main | |
|
||||
Materialized view "public.mvtest_bb"
|
||||
Column | Type | Collation | Nullable | Default | Storage | Stats target | Description
|
||||
----------+---------+-----------+----------+---------+---------+--------------+-------------
|
||||
grandtot | numeric | | | | main | |
|
||||
Indexes:
|
||||
"mvtest_aa" btree (grandtot)
|
||||
View definition:
|
||||
@ -142,10 +142,10 @@ CREATE SCHEMA mvtest_mvschema;
|
||||
ALTER MATERIALIZED VIEW mvtest_tvm SET SCHEMA mvtest_mvschema;
|
||||
\d+ mvtest_tvm
|
||||
\d+ mvtest_tvmm
|
||||
Materialized view "public.mvtest_tvmm"
|
||||
Column | Type | Modifiers | Storage | Stats target | Description
|
||||
----------+---------+-----------+---------+--------------+-------------
|
||||
grandtot | numeric | | main | |
|
||||
Materialized view "public.mvtest_tvmm"
|
||||
Column | Type | Collation | Nullable | Default | Storage | Stats target | Description
|
||||
----------+---------+-----------+----------+---------+---------+--------------+-------------
|
||||
grandtot | numeric | | | | main | |
|
||||
Indexes:
|
||||
"mvtest_tvmm_expr" UNIQUE, btree ((grandtot > 0::numeric))
|
||||
"mvtest_tvmm_pred" UNIQUE, btree (grandtot) WHERE grandtot < 0::numeric
|
||||
@ -155,11 +155,11 @@ View definition:
|
||||
|
||||
SET search_path = mvtest_mvschema, public;
|
||||
\d+ mvtest_tvm
|
||||
Materialized view "mvtest_mvschema.mvtest_tvm"
|
||||
Column | Type | Modifiers | Storage | Stats target | Description
|
||||
--------+---------+-----------+----------+--------------+-------------
|
||||
type | text | | extended | |
|
||||
totamt | numeric | | main | |
|
||||
Materialized view "mvtest_mvschema.mvtest_tvm"
|
||||
Column | Type | Collation | Nullable | Default | Storage | Stats target | Description
|
||||
--------+---------+-----------+----------+---------+----------+--------------+-------------
|
||||
type | text | | | | extended | |
|
||||
totamt | numeric | | | | main | |
|
||||
View definition:
|
||||
SELECT mvtest_tv.type,
|
||||
mvtest_tv.totamt
|
||||
@ -340,11 +340,11 @@ ROLLBACK;
|
||||
CREATE VIEW mvtest_vt1 AS SELECT 1 moo;
|
||||
CREATE VIEW mvtest_vt2 AS SELECT moo, 2*moo FROM mvtest_vt1 UNION ALL SELECT moo, 3*moo FROM mvtest_vt1;
|
||||
\d+ mvtest_vt2
|
||||
View "public.mvtest_vt2"
|
||||
Column | Type | Modifiers | Storage | Description
|
||||
----------+---------+-----------+---------+-------------
|
||||
moo | integer | | plain |
|
||||
?column? | integer | | plain |
|
||||
View "public.mvtest_vt2"
|
||||
Column | Type | Collation | Nullable | Default | Storage | Description
|
||||
----------+---------+-----------+----------+---------+---------+-------------
|
||||
moo | integer | | | | plain |
|
||||
?column? | integer | | | | plain |
|
||||
View definition:
|
||||
SELECT mvtest_vt1.moo,
|
||||
2 * mvtest_vt1.moo
|
||||
@ -356,11 +356,11 @@ UNION ALL
|
||||
|
||||
CREATE MATERIALIZED VIEW mv_test2 AS SELECT moo, 2*moo FROM mvtest_vt2 UNION ALL SELECT moo, 3*moo FROM mvtest_vt2;
|
||||
\d+ mv_test2
|
||||
Materialized view "public.mv_test2"
|
||||
Column | Type | Modifiers | Storage | Stats target | Description
|
||||
----------+---------+-----------+---------+--------------+-------------
|
||||
moo | integer | | plain | |
|
||||
?column? | integer | | plain | |
|
||||
Materialized view "public.mv_test2"
|
||||
Column | Type | Collation | Nullable | Default | Storage | Stats target | Description
|
||||
----------+---------+-----------+----------+---------+---------+--------------+-------------
|
||||
moo | integer | | | | plain | |
|
||||
?column? | integer | | | | plain | |
|
||||
View definition:
|
||||
SELECT mvtest_vt2.moo,
|
||||
2 * mvtest_vt2.moo
|
||||
|
@ -1495,13 +1495,13 @@ select * from dfview;
|
||||
(5 rows)
|
||||
|
||||
\d+ dfview
|
||||
View "public.dfview"
|
||||
Column | Type | Modifiers | Storage | Description
|
||||
--------+--------+-----------+---------+-------------
|
||||
q1 | bigint | | plain |
|
||||
q2 | bigint | | plain |
|
||||
c3 | bigint | | plain |
|
||||
c4 | bigint | | plain |
|
||||
View "public.dfview"
|
||||
Column | Type | Collation | Nullable | Default | Storage | Description
|
||||
--------+--------+-----------+----------+---------+---------+-------------
|
||||
q1 | bigint | | | | plain |
|
||||
q2 | bigint | | | | plain |
|
||||
c3 | bigint | | | | plain |
|
||||
c4 | bigint | | | | plain |
|
||||
View definition:
|
||||
SELECT int8_tbl.q1,
|
||||
int8_tbl.q2,
|
||||
|
@ -218,10 +218,10 @@ rollback;
|
||||
-- Commit table creation
|
||||
COMMIT PREPARED 'regress-one';
|
||||
\d pxtest2
|
||||
Table "public.pxtest2"
|
||||
Column | Type | Modifiers
|
||||
--------+---------+-----------
|
||||
a | integer |
|
||||
Table "public.pxtest2"
|
||||
Column | Type | Collation | Nullable | Default
|
||||
--------+---------+-----------+----------+---------
|
||||
a | integer | | |
|
||||
|
||||
SELECT * FROM pxtest2;
|
||||
a
|
||||
|
@ -77,13 +77,13 @@ SELECT relreplident FROM pg_class WHERE oid = 'test_replica_identity'::regclass;
|
||||
(1 row)
|
||||
|
||||
\d test_replica_identity
|
||||
Table "public.test_replica_identity"
|
||||
Column | Type | Modifiers
|
||||
--------+---------+--------------------------------------------------------------------
|
||||
id | integer | not null default nextval('test_replica_identity_id_seq'::regclass)
|
||||
keya | text | not null
|
||||
keyb | text | not null
|
||||
nonkey | text |
|
||||
Table "public.test_replica_identity"
|
||||
Column | Type | Collation | Nullable | Default
|
||||
--------+---------+-----------+----------+---------------------------------------------------
|
||||
id | integer | | not null | nextval('test_replica_identity_id_seq'::regclass)
|
||||
keya | text | | not null |
|
||||
keyb | text | | not null |
|
||||
nonkey | text | | |
|
||||
Indexes:
|
||||
"test_replica_identity_pkey" PRIMARY KEY, btree (id) REPLICA IDENTITY
|
||||
"test_replica_identity_expr" UNIQUE, btree (keya, keyb, (3))
|
||||
@ -110,13 +110,13 @@ SELECT relreplident FROM pg_class WHERE oid = 'test_replica_identity'::regclass;
|
||||
(1 row)
|
||||
|
||||
\d test_replica_identity
|
||||
Table "public.test_replica_identity"
|
||||
Column | Type | Modifiers
|
||||
--------+---------+--------------------------------------------------------------------
|
||||
id | integer | not null default nextval('test_replica_identity_id_seq'::regclass)
|
||||
keya | text | not null
|
||||
keyb | text | not null
|
||||
nonkey | text |
|
||||
Table "public.test_replica_identity"
|
||||
Column | Type | Collation | Nullable | Default
|
||||
--------+---------+-----------+----------+---------------------------------------------------
|
||||
id | integer | | not null | nextval('test_replica_identity_id_seq'::regclass)
|
||||
keya | text | | not null |
|
||||
keyb | text | | not null |
|
||||
nonkey | text | | |
|
||||
Indexes:
|
||||
"test_replica_identity_pkey" PRIMARY KEY, btree (id)
|
||||
"test_replica_identity_expr" UNIQUE, btree (keya, keyb, (3))
|
||||
@ -159,13 +159,13 @@ SELECT relreplident FROM pg_class WHERE oid = 'test_replica_identity'::regclass;
|
||||
(1 row)
|
||||
|
||||
\d+ test_replica_identity
|
||||
Table "public.test_replica_identity"
|
||||
Column | Type | Modifiers | Storage | Stats target | Description
|
||||
--------+---------+--------------------------------------------------------------------+----------+--------------+-------------
|
||||
id | integer | not null default nextval('test_replica_identity_id_seq'::regclass) | plain | |
|
||||
keya | text | not null | extended | |
|
||||
keyb | text | not null | extended | |
|
||||
nonkey | text | | extended | |
|
||||
Table "public.test_replica_identity"
|
||||
Column | Type | Collation | Nullable | Default | Storage | Stats target | Description
|
||||
--------+---------+-----------+----------+---------------------------------------------------+----------+--------------+-------------
|
||||
id | integer | | not null | nextval('test_replica_identity_id_seq'::regclass) | plain | |
|
||||
keya | text | | not null | | extended | |
|
||||
keyb | text | | not null | | extended | |
|
||||
nonkey | text | | | | extended | |
|
||||
Indexes:
|
||||
"test_replica_identity_pkey" PRIMARY KEY, btree (id)
|
||||
"test_replica_identity_expr" UNIQUE, btree (keya, keyb, (3))
|
||||
|
@ -2707,11 +2707,11 @@ select * from rules_log;
|
||||
|
||||
create rule r3 as on delete to rules_src do notify rules_src_deletion;
|
||||
\d+ rules_src
|
||||
Table "public.rules_src"
|
||||
Column | Type | Modifiers | Storage | Stats target | Description
|
||||
--------+---------+-----------+---------+--------------+-------------
|
||||
f1 | integer | | plain | |
|
||||
f2 | integer | | plain | |
|
||||
Table "public.rules_src"
|
||||
Column | Type | Collation | Nullable | Default | Storage | Stats target | Description
|
||||
--------+---------+-----------+----------+---------+---------+--------------+-------------
|
||||
f1 | integer | | | | plain | |
|
||||
f2 | integer | | | | plain | |
|
||||
Rules:
|
||||
r1 AS
|
||||
ON UPDATE TO rules_src DO INSERT INTO rules_log (f1, f2, tag) VALUES (old.f1,old.f2,'old'::text), (new.f1,new.f2,'new'::text)
|
||||
@ -2727,11 +2727,11 @@ Rules:
|
||||
create rule r4 as on insert to rules_src do instead insert into rules_log AS trgt SELECT NEW.* RETURNING trgt.f1, trgt.f2;
|
||||
create rule r5 as on update to rules_src do instead UPDATE rules_log AS trgt SET tag = 'updated' WHERE trgt.f1 = new.f1;
|
||||
\d+ rules_src
|
||||
Table "public.rules_src"
|
||||
Column | Type | Modifiers | Storage | Stats target | Description
|
||||
--------+---------+-----------+---------+--------------+-------------
|
||||
f1 | integer | | plain | |
|
||||
f2 | integer | | plain | |
|
||||
Table "public.rules_src"
|
||||
Column | Type | Collation | Nullable | Default | Storage | Stats target | Description
|
||||
--------+---------+-----------+----------+---------+---------+--------------+-------------
|
||||
f1 | integer | | | | plain | |
|
||||
f2 | integer | | | | plain | |
|
||||
Rules:
|
||||
r1 AS
|
||||
ON UPDATE TO rules_src DO INSERT INTO rules_log (f1, f2, tag) VALUES (old.f1,old.f2,'old'::text), (new.f1,new.f2,'new'::text)
|
||||
@ -2767,10 +2767,10 @@ SELECT * FROM rule_v1;
|
||||
(1 row)
|
||||
|
||||
\d+ rule_v1
|
||||
View "public.rule_v1"
|
||||
Column | Type | Modifiers | Storage | Description
|
||||
--------+---------+-----------+---------+-------------
|
||||
a | integer | | plain |
|
||||
View "public.rule_v1"
|
||||
Column | Type | Collation | Nullable | Default | Storage | Description
|
||||
--------+---------+-----------+----------+---------+---------+-------------
|
||||
a | integer | | | | plain |
|
||||
View definition:
|
||||
SELECT rule_t1.a
|
||||
FROM rule_t1;
|
||||
@ -2795,22 +2795,22 @@ DROP TABLE rule_t1;
|
||||
--
|
||||
create view rule_v1 as values(1,2);
|
||||
\d+ rule_v1
|
||||
View "public.rule_v1"
|
||||
Column | Type | Modifiers | Storage | Description
|
||||
---------+---------+-----------+---------+-------------
|
||||
column1 | integer | | plain |
|
||||
column2 | integer | | plain |
|
||||
View "public.rule_v1"
|
||||
Column | Type | Collation | Nullable | Default | Storage | Description
|
||||
---------+---------+-----------+----------+---------+---------+-------------
|
||||
column1 | integer | | | | plain |
|
||||
column2 | integer | | | | plain |
|
||||
View definition:
|
||||
VALUES (1,2);
|
||||
|
||||
drop view rule_v1;
|
||||
create view rule_v1(x) as values(1,2);
|
||||
\d+ rule_v1
|
||||
View "public.rule_v1"
|
||||
Column | Type | Modifiers | Storage | Description
|
||||
---------+---------+-----------+---------+-------------
|
||||
x | integer | | plain |
|
||||
column2 | integer | | plain |
|
||||
View "public.rule_v1"
|
||||
Column | Type | Collation | Nullable | Default | Storage | Description
|
||||
---------+---------+-----------+----------+---------+---------+-------------
|
||||
x | integer | | | | plain |
|
||||
column2 | integer | | | | plain |
|
||||
View definition:
|
||||
SELECT "*VALUES*".column1 AS x,
|
||||
"*VALUES*".column2
|
||||
@ -2819,11 +2819,11 @@ View definition:
|
||||
drop view rule_v1;
|
||||
create view rule_v1(x) as select * from (values(1,2)) v;
|
||||
\d+ rule_v1
|
||||
View "public.rule_v1"
|
||||
Column | Type | Modifiers | Storage | Description
|
||||
---------+---------+-----------+---------+-------------
|
||||
x | integer | | plain |
|
||||
column2 | integer | | plain |
|
||||
View "public.rule_v1"
|
||||
Column | Type | Collation | Nullable | Default | Storage | Description
|
||||
---------+---------+-----------+----------+---------+---------+-------------
|
||||
x | integer | | | | plain |
|
||||
column2 | integer | | | | plain |
|
||||
View definition:
|
||||
SELECT v.column1 AS x,
|
||||
v.column2
|
||||
@ -2832,11 +2832,11 @@ View definition:
|
||||
drop view rule_v1;
|
||||
create view rule_v1(x) as select * from (values(1,2)) v(q,w);
|
||||
\d+ rule_v1
|
||||
View "public.rule_v1"
|
||||
Column | Type | Modifiers | Storage | Description
|
||||
--------+---------+-----------+---------+-------------
|
||||
x | integer | | plain |
|
||||
w | integer | | plain |
|
||||
View "public.rule_v1"
|
||||
Column | Type | Collation | Nullable | Default | Storage | Description
|
||||
--------+---------+-----------+----------+---------+---------+-------------
|
||||
x | integer | | | | plain |
|
||||
w | integer | | | | plain |
|
||||
View definition:
|
||||
SELECT v.q AS x,
|
||||
v.w
|
||||
|
@ -69,19 +69,19 @@ CREATE VIEW test_tablesample_v1 AS
|
||||
CREATE VIEW test_tablesample_v2 AS
|
||||
SELECT id FROM test_tablesample TABLESAMPLE SYSTEM (99);
|
||||
\d+ test_tablesample_v1
|
||||
View "public.test_tablesample_v1"
|
||||
Column | Type | Modifiers | Storage | Description
|
||||
--------+---------+-----------+---------+-------------
|
||||
id | integer | | plain |
|
||||
View "public.test_tablesample_v1"
|
||||
Column | Type | Collation | Nullable | Default | Storage | Description
|
||||
--------+---------+-----------+----------+---------+---------+-------------
|
||||
id | integer | | | | plain |
|
||||
View definition:
|
||||
SELECT test_tablesample.id
|
||||
FROM test_tablesample TABLESAMPLE system ((10 * 2)) REPEATABLE (2);
|
||||
|
||||
\d+ test_tablesample_v2
|
||||
View "public.test_tablesample_v2"
|
||||
Column | Type | Modifiers | Storage | Description
|
||||
--------+---------+-----------+---------+-------------
|
||||
id | integer | | plain |
|
||||
View "public.test_tablesample_v2"
|
||||
Column | Type | Collation | Nullable | Default | Storage | Description
|
||||
--------+---------+-----------+----------+---------+---------+-------------
|
||||
id | integer | | | | plain |
|
||||
View definition:
|
||||
SELECT test_tablesample.id
|
||||
FROM test_tablesample TABLESAMPLE system (99);
|
||||
|
@ -1059,11 +1059,11 @@ DELETE 1
|
||||
\set QUIET true
|
||||
-- Describe view should list triggers
|
||||
\d main_view
|
||||
View "public.main_view"
|
||||
Column | Type | Modifiers
|
||||
--------+---------+-----------
|
||||
a | integer |
|
||||
b | integer |
|
||||
View "public.main_view"
|
||||
Column | Type | Collation | Nullable | Default
|
||||
--------+---------+-----------+----------+---------
|
||||
a | integer | | |
|
||||
b | integer | | |
|
||||
Triggers:
|
||||
after_del_stmt_trig AFTER DELETE ON main_view FOR EACH STATEMENT EXECUTE PROCEDURE view_trigger('after_view_del_stmt')
|
||||
after_ins_stmt_trig AFTER INSERT ON main_view FOR EACH STATEMENT EXECUTE PROCEDURE view_trigger('after_view_ins_stmt')
|
||||
@ -1079,11 +1079,11 @@ Triggers:
|
||||
DROP TRIGGER instead_of_insert_trig ON main_view;
|
||||
DROP TRIGGER instead_of_delete_trig ON main_view;
|
||||
\d+ main_view
|
||||
View "public.main_view"
|
||||
Column | Type | Modifiers | Storage | Description
|
||||
--------+---------+-----------+---------+-------------
|
||||
a | integer | | plain |
|
||||
b | integer | | plain |
|
||||
View "public.main_view"
|
||||
Column | Type | Collation | Nullable | Default | Storage | Description
|
||||
--------+---------+-----------+----------+---------+---------+-------------
|
||||
a | integer | | | | plain |
|
||||
b | integer | | | | plain |
|
||||
View definition:
|
||||
SELECT main_table.a,
|
||||
main_table.b
|
||||
|
@ -10,11 +10,11 @@ SELECT * FROM persons;
|
||||
(0 rows)
|
||||
|
||||
\d persons
|
||||
Table "public.persons"
|
||||
Column | Type | Modifiers
|
||||
--------+---------+-----------
|
||||
id | integer |
|
||||
name | text |
|
||||
Table "public.persons"
|
||||
Column | Type | Collation | Nullable | Default
|
||||
--------+---------+-----------+----------+---------
|
||||
id | integer | | |
|
||||
name | text | | |
|
||||
Typed table of type: person_type
|
||||
|
||||
CREATE FUNCTION get_all_persons() RETURNS SETOF person_type
|
||||
@ -46,11 +46,11 @@ CREATE TABLE persons2 OF person_type (
|
||||
UNIQUE (name)
|
||||
);
|
||||
\d persons2
|
||||
Table "public.persons2"
|
||||
Column | Type | Modifiers
|
||||
--------+---------+-----------
|
||||
id | integer | not null
|
||||
name | text |
|
||||
Table "public.persons2"
|
||||
Column | Type | Collation | Nullable | Default
|
||||
--------+---------+-----------+----------+---------
|
||||
id | integer | | not null |
|
||||
name | text | | |
|
||||
Indexes:
|
||||
"persons2_pkey" PRIMARY KEY, btree (id)
|
||||
"persons2_name_key" UNIQUE CONSTRAINT, btree (name)
|
||||
@ -61,11 +61,11 @@ CREATE TABLE persons3 OF person_type (
|
||||
name WITH OPTIONS DEFAULT ''
|
||||
);
|
||||
\d persons3
|
||||
Table "public.persons3"
|
||||
Column | Type | Modifiers
|
||||
--------+---------+------------------
|
||||
id | integer | not null
|
||||
name | text | default ''::text
|
||||
Table "public.persons3"
|
||||
Column | Type | Collation | Nullable | Default
|
||||
--------+---------+-----------+----------+----------
|
||||
id | integer | | not null |
|
||||
name | text | | | ''::text
|
||||
Indexes:
|
||||
"persons3_pkey" PRIMARY KEY, btree (id)
|
||||
Typed table of type: person_type
|
||||
|
@ -1433,11 +1433,11 @@ INSERT INTO base_tbl VALUES (1,2), (2,3), (1,-1);
|
||||
CREATE VIEW rw_view1 AS SELECT * FROM base_tbl WHERE a < b
|
||||
WITH LOCAL CHECK OPTION;
|
||||
\d+ rw_view1
|
||||
View "public.rw_view1"
|
||||
Column | Type | Modifiers | Storage | Description
|
||||
--------+---------+-----------+---------+-------------
|
||||
a | integer | | plain |
|
||||
b | integer | | plain |
|
||||
View "public.rw_view1"
|
||||
Column | Type | Collation | Nullable | Default | Storage | Description
|
||||
--------+---------+-----------+----------+---------+---------+-------------
|
||||
a | integer | | | | plain |
|
||||
b | integer | | | | plain |
|
||||
View definition:
|
||||
SELECT base_tbl.a,
|
||||
base_tbl.b
|
||||
@ -1487,10 +1487,10 @@ CREATE VIEW rw_view1 AS SELECT * FROM base_tbl WHERE a > 0;
|
||||
CREATE VIEW rw_view2 AS SELECT * FROM rw_view1 WHERE a < 10
|
||||
WITH CHECK OPTION; -- implicitly cascaded
|
||||
\d+ rw_view2
|
||||
View "public.rw_view2"
|
||||
Column | Type | Modifiers | Storage | Description
|
||||
--------+---------+-----------+---------+-------------
|
||||
a | integer | | plain |
|
||||
View "public.rw_view2"
|
||||
Column | Type | Collation | Nullable | Default | Storage | Description
|
||||
--------+---------+-----------+----------+---------+---------+-------------
|
||||
a | integer | | | | plain |
|
||||
View definition:
|
||||
SELECT rw_view1.a
|
||||
FROM rw_view1
|
||||
@ -1527,10 +1527,10 @@ DETAIL: Failing row contains (15).
|
||||
CREATE OR REPLACE VIEW rw_view2 AS SELECT * FROM rw_view1 WHERE a < 10
|
||||
WITH LOCAL CHECK OPTION;
|
||||
\d+ rw_view2
|
||||
View "public.rw_view2"
|
||||
Column | Type | Modifiers | Storage | Description
|
||||
--------+---------+-----------+---------+-------------
|
||||
a | integer | | plain |
|
||||
View "public.rw_view2"
|
||||
Column | Type | Collation | Nullable | Default | Storage | Description
|
||||
--------+---------+-----------+----------+---------+---------+-------------
|
||||
a | integer | | | | plain |
|
||||
View definition:
|
||||
SELECT rw_view1.a
|
||||
FROM rw_view1
|
||||
@ -1568,10 +1568,10 @@ ERROR: new row violates check option for view "rw_view2"
|
||||
DETAIL: Failing row contains (30).
|
||||
ALTER VIEW rw_view2 RESET (check_option);
|
||||
\d+ rw_view2
|
||||
View "public.rw_view2"
|
||||
Column | Type | Modifiers | Storage | Description
|
||||
--------+---------+-----------+---------+-------------
|
||||
a | integer | | plain |
|
||||
View "public.rw_view2"
|
||||
Column | Type | Collation | Nullable | Default | Storage | Description
|
||||
--------+---------+-----------+----------+---------+---------+-------------
|
||||
a | integer | | | | plain |
|
||||
View definition:
|
||||
SELECT rw_view1.a
|
||||
FROM rw_view1
|
||||
|
@ -354,10 +354,10 @@ UNION ALL
|
||||
)
|
||||
SELECT sum(n) FROM t;
|
||||
\d+ sums_1_100
|
||||
View "public.sums_1_100"
|
||||
Column | Type | Modifiers | Storage | Description
|
||||
--------+--------+-----------+---------+-------------
|
||||
sum | bigint | | plain |
|
||||
View "public.sums_1_100"
|
||||
Column | Type | Collation | Nullable | Default | Storage | Description
|
||||
--------+--------+-----------+----------+---------+---------+-------------
|
||||
sum | bigint | | | | plain |
|
||||
View definition:
|
||||
WITH RECURSIVE t(n) AS (
|
||||
VALUES (1)
|
||||
|
Loading…
x
Reference in New Issue
Block a user