gettext_noop("materialized view"),
gettext_noop("sequence"),
gettext_noop("foreign table"),
- gettext_noop("table"), /* partitioned table */
+ gettext_noop("partitioned table"),
gettext_noop("Type"));
printACLColumn(&buf, "c.relacl");
schemaname, relationname);
break;
case RELKIND_INDEX:
- case RELKIND_PARTITIONED_INDEX:
if (tableinfo.relpersistence == 'u')
printfPQExpBuffer(&title, _("Unlogged index \"%s.%s\""),
schemaname, relationname);
printfPQExpBuffer(&title, _("Index \"%s.%s\""),
schemaname, relationname);
break;
+ case RELKIND_PARTITIONED_INDEX:
+ if (tableinfo.relpersistence == 'u')
+ printfPQExpBuffer(&title, _("Unlogged partitioned index \"%s.%s\""),
+ schemaname, relationname);
+ else
+ printfPQExpBuffer(&title, _("Partitioned index \"%s.%s\""),
+ schemaname, relationname);
+ break;
case 's':
/* not used as of 8.2, but keep it for backwards compatibility */
printfPQExpBuffer(&title, _("Special relation \"%s.%s\""),
break;
case RELKIND_PARTITIONED_TABLE:
if (tableinfo.relpersistence == 'u')
- printfPQExpBuffer(&title, _("Unlogged table \"%s.%s\""),
+ printfPQExpBuffer(&title, _("Unlogged partitioned table \"%s.%s\""),
schemaname, relationname);
else
- printfPQExpBuffer(&title, _("Table \"%s.%s\""),
+ printfPQExpBuffer(&title, _("Partitioned table \"%s.%s\""),
schemaname, relationname);
break;
default:
gettext_noop("sequence"),
gettext_noop("special"),
gettext_noop("foreign table"),
- gettext_noop("table"), /* partitioned table */
- gettext_noop("index"), /* partitioned index */
+ gettext_noop("partitioned table"),
+ gettext_noop("partitioned index"),
gettext_noop("Type"),
gettext_noop("Owner"));
ERROR: cannot inherit from partitioned table "partitioned2"
-- Partition key in describe output
\d partitioned
- Table "public.partitioned"
+ Partitioned table "public.partitioned"
Column | Type | Collation | Nullable | Default
--------+---------+-----------+----------+---------
a | integer | | |
Number of partitions: 0
\d+ partitioned2
- Table "public.partitioned2"
+ Partitioned table "public.partitioned2"
Column | Type | Collation | Nullable | Default | Storage | Stats target | Description
--------+---------+-----------+----------+---------+----------+--------------+-------------
a | integer | | | | plain | |
-- Both partition bound and partition key in describe output
\d+ part_c
- Table "public.part_c"
+ Partitioned table "public.part_c"
Column | Type | Collation | Nullable | Default | Storage | Stats target | Description
--------+---------+-----------+----------+---------+----------+--------------+-------------
a | text | | | | extended | |
-- output could vary depending on the order in which partition oids are
-- returned.
\d parted
- Table "public.parted"
+ Partitioned table "public.parted"
Column | Type | Collation | Nullable | Default
--------+---------+-----------+----------+---------
a | text | | |
Number of partitions: 3 (Use \d+ to list them.)
\d hash_parted
- Table "public.hash_parted"
+ Partitioned table "public.hash_parted"
Column | Type | Collation | Nullable | Default
--------+---------+-----------+----------+---------
a | integer | | |
(1 row)
\d+ parted_col_comment
- Table "public.parted_col_comment"
+ Partitioned table "public.parted_col_comment"
Column | Type | Collation | Nullable | Default | Storage | Stats target | Description
--------+---------+-----------+----------+---------+----------+--------------+---------------
a | integer | | | | plain | | Partition key
create table boolspart_t partition of boolspart for values in (true);
create table boolspart_f partition of boolspart for values in (false);
\d+ boolspart
- Table "public.boolspart"
+ Partitioned table "public.boolspart"
Column | Type | Collation | Nullable | Default | Storage | Stats target | Description
--------+---------+-----------+----------+---------+---------+--------------+-------------
a | boolean | | | | plain | |
CREATE FOREIGN TABLE fd_pt2_1 PARTITION OF fd_pt2 FOR VALUES IN (1)
SERVER s0 OPTIONS (delimiter ',', quote '"', "be quoted" 'value');
\d+ fd_pt2
- Table "public.fd_pt2"
+ Partitioned table "public.fd_pt2"
Column | Type | Collation | Nullable | Default | Storage | Stats target | Description
--------+---------+-----------+----------+---------+----------+--------------+-------------
c1 | integer | | not null | | plain | |
DETAIL: The new partition may contain only the columns present in parent.
DROP FOREIGN TABLE fd_pt2_1;
\d+ fd_pt2
- Table "public.fd_pt2"
+ Partitioned table "public.fd_pt2"
Column | Type | Collation | Nullable | Default | Storage | Stats target | Description
--------+---------+-----------+----------+---------+----------+--------------+-------------
c1 | integer | | not null | | plain | |
-- no attach partition validation occurs for foreign tables
ALTER TABLE fd_pt2 ATTACH PARTITION fd_pt2_1 FOR VALUES IN (1);
\d+ fd_pt2
- Table "public.fd_pt2"
+ Partitioned table "public.fd_pt2"
Column | Type | Collation | Nullable | Default | Storage | Stats target | Description
--------+---------+-----------+----------+---------+----------+--------------+-------------
c1 | integer | | not null | | plain | |
ALTER TABLE fd_pt2_1 ALTER c3 SET NOT NULL;
ALTER TABLE fd_pt2_1 ADD CONSTRAINT p21chk CHECK (c2 <> '');
\d+ fd_pt2
- Table "public.fd_pt2"
+ Partitioned table "public.fd_pt2"
Column | Type | Collation | Nullable | Default | Storage | Stats target | Description
--------+---------+-----------+----------+---------+----------+--------------+-------------
c1 | integer | | not null | | plain | |
ALTER TABLE fd_pt2 DETACH PARTITION fd_pt2_1;
ALTER TABLE fd_pt2 ALTER c2 SET NOT NULL;
\d+ fd_pt2
- Table "public.fd_pt2"
+ Partitioned table "public.fd_pt2"
Column | Type | Collation | Nullable | Default | Storage | Stats target | Description
--------+---------+-----------+----------+---------+----------+--------------+-------------
c1 | integer | | not null | | plain | |
ALTER TABLE fd_pt2 DETACH PARTITION fd_pt2_1;
ALTER TABLE fd_pt2 ADD CONSTRAINT fd_pt2chk1 CHECK (c1 > 0);
\d+ fd_pt2
- Table "public.fd_pt2"
+ Partitioned table "public.fd_pt2"
Column | Type | Collation | Nullable | Default | Storage | Stats target | Description
--------+---------+-----------+----------+---------+----------+--------------+-------------
c1 | integer | | not null | | plain | |
ALTER TABLE fk_partitioned_fk ATTACH PARTITION fk_partitioned_fk_4 FOR VALUES IN (3500,3502);
-- should only have one constraint
\d fk_partitioned_fk_4
- Table "public.fk_partitioned_fk_4"
+ Partitioned table "public.fk_partitioned_fk_4"
Column | Type | Collation | Nullable | Default
--------+---------+-----------+----------+---------
a | integer | | |
-- this one has two constraints, similar but not quite the one in the parent,
-- so it gets a new one
\d fk_partitioned_fk_5
- Table "public.fk_partitioned_fk_5"
+ Partitioned table "public.fk_partitioned_fk_5"
Column | Type | Collation | Nullable | Default
--------+---------+-----------+----------+---------
a | integer | | |
"idxpart1_a_idx" btree (a)
\d idxpart2
- Table "public.idxpart2"
+ Partitioned table "public.idxpart2"
Column | Type | Collation | Nullable | Default
--------+---------+-----------+----------+---------
a | integer | | |
-- attaching idxpart22 is not enough to set idxpart22_a_idx valid ...
alter index idxpart2_a_idx attach partition idxpart22_a_idx;
\d idxpart2
- Table "public.idxpart2"
+ Partitioned table "public.idxpart2"
Column | Type | Collation | Nullable | Default
--------+---------+-----------+----------+---------
a | integer | | |
create index on idxpart21 (a);
alter index idxpart2_a_idx attach partition idxpart21_a_idx;
\d idxpart2
- Table "public.idxpart2"
+ Partitioned table "public.idxpart2"
Column | Type | Collation | Nullable | Default
--------+---------+-----------+----------+---------
a | integer | | |
create index on idxpart (col_keep);
alter table idxpart attach partition idxpart1 for values from (0) to (1000);
\d idxpart
- Table "public.idxpart"
+ Partitioned table "public.idxpart"
Column | Type | Collation | Nullable | Default
----------+---------+-----------+----------+---------
col_keep | integer | | |
create index on idxpart (col_keep);
alter table idxpart attach partition idxpart1 for values from (0) to (1000);
\d idxpart
- Table "public.idxpart"
+ Partitioned table "public.idxpart"
Column | Type | Collation | Nullable | Default
----------+---------+-----------+----------+---------
col_keep | integer | | |
-- Verify that it works to add primary key / unique to partitioned tables
create table idxpart (a int primary key, b int) partition by range (a);
\d idxpart
- Table "public.idxpart"
+ Partitioned table "public.idxpart"
Column | Type | Collation | Nullable | Default
--------+---------+-----------+----------+---------
a | integer | | not null |
DETAIL: PRIMARY KEY constraint on table "idxpart" lacks column "b" which is part of the partition key.
alter table idxpart add primary key (a, b); -- this works
\d idxpart
- Table "public.idxpart"
+ Partitioned table "public.idxpart"
Column | Type | Collation | Nullable | Default
--------+---------+-----------+----------+---------
a | integer | | not null |
DETAIL: UNIQUE constraint on table "idxpart" lacks column "b" which is part of the partition key.
alter table idxpart add unique (b, a); -- this works
\d idxpart
- Table "public.idxpart"
+ Partitioned table "public.idxpart"
Column | Type | Collation | Nullable | Default
--------+---------+-----------+----------+---------
a | integer | | |
-- test \d+ output on a table which has both partitioned and unpartitioned
-- partitions
\d+ list_parted
- Table "public.list_parted"
+ Partitioned table "public.list_parted"
Column | Type | Collation | Nullable | Default | Storage | Stats target | Description
--------+---------+-----------+----------+---------+----------+--------------+-------------
a | text | | | | extended | |
create table mcrparted7_gt_common_lt_d partition of mcrparted for values from ('common', maxvalue) to ('d', minvalue);
create table mcrparted8_ge_d partition of mcrparted for values from ('d', minvalue) to (maxvalue, maxvalue);
\d+ mcrparted
- Table "public.mcrparted"
+ Partitioned table "public.mcrparted"
Column | Type | Collation | Nullable | Default | Storage | Stats target | Description
--------+---------+-----------+----------+---------+----------+--------------+-------------
a | text | | | | extended | |
CREATE POLICY pp1r ON part_document AS RESTRICTIVE TO regress_rls_dave
USING (cid < 55);
\d+ part_document
- Table "regress_rls_schema.part_document"
+ Partitioned table "regress_rls_schema.part_document"
Column | Type | Collation | Nullable | Default | Storage | Stats target | Description
---------+---------+-----------+----------+---------+----------+--------------+-------------
did | integer | | | | plain | |