else
{
const char *s = _("Inherits");
- int sw = pg_wcswidth(s, strlen(s), pset.encoding);
tuples = PQntuples(result);
- for (i = 0; i < tuples; i++)
+ if (tuples > 0)
{
- if (i == 0)
- printfPQExpBuffer(&buf, "%s: %s",
- s, PQgetvalue(result, i, 0));
- else
- printfPQExpBuffer(&buf, "%*s %s",
- sw, "", PQgetvalue(result, i, 0));
- if (i < tuples - 1)
- appendPQExpBufferChar(&buf, ',');
+ printfPQExpBuffer(&buf, "%s:", s);
+ printTableAddFooter(&cont, buf.data);
+ }
+ for (i = 0; i < tuples; i++)
+ {
+ printfPQExpBuffer(&buf, " %s", PQgetvalue(result, i, 0));
printTableAddFooter(&cont, buf.data);
}
d | integer | | |
Check constraints:
"con1" CHECK (a > 0)
-Inherits: constraint_rename_test
+Inherits:
+ constraint_rename_test
ALTER TABLE constraint_rename_test2 RENAME CONSTRAINT con1 TO con1foo; -- fail
ERROR: cannot rename inherited constraint "con1"
d | integer | | |
Check constraints:
"con1foo" CHECK (a > 0)
-Inherits: constraint_rename_test
+Inherits:
+ constraint_rename_test
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
d | integer | | |
Check constraints:
"con1foo" CHECK (a > 0)
-Inherits: constraint_rename_test
+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 | integer | | |
Check constraints:
"con1foo" CHECK (a > 0)
-Inherits: constraint_rename_test
+Inherits:
+ constraint_rename_test
DROP TABLE constraint_rename_test2;
DROP TABLE constraint_rename_test;
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
-Inherits: nv_parent
+Inherits:
+ nv_parent
-- we leave nv_parent and children around to help test pg_dump logic
-- Foreign key adding test with mixed types
b | double precision | | |
Check constraints:
"test_inh_check_a_check" CHECK (a > 10.2::double precision)
-Inherits: test_inh_check
+Inherits:
+ test_inh_check
select relname, conname, coninhcount, conislocal, connoinherit
from pg_constraint c, pg_class r
b | double precision | | |
Check constraints:
"test_inh_check_a_check" CHECK (a::double precision > 10.2::double precision)
-Inherits: test_inh_check
+Inherits:
+ test_inh_check
select relname, conname, coninhcount, conislocal, connoinherit
from pg_constraint c, pg_class r
"blocal" CHECK (b < 1000::double precision)
"bmerged" CHECK (b > 1::double precision)
"test_inh_check_a_check" CHECK (a::double precision > 10.2::double precision)
-Inherits: test_inh_check
+Inherits:
+ test_inh_check
select relname, conname, coninhcount, conislocal, connoinherit
from pg_constraint c, pg_class r
"blocal" CHECK (b::double precision < 1000::double precision)
"bmerged" CHECK (b::double precision > 1::double precision)
"test_inh_check_a_check" CHECK (a::double precision > 10.2::double precision)
-Inherits: test_inh_check
+Inherits:
+ test_inh_check
select relname, conname, coninhcount, conislocal, connoinherit
from pg_constraint c, pg_class r
--------+---------+-----------+----------+---------
aa | integer | | |
c | text | | |
-Inherits: test_tbl2
+Inherits:
+ test_tbl2
DROP TABLE test_tbl2_subclass, test_tbl2;
DROP TYPE test_type2;
Column | Type | Collation | Nullable | Default | Storage | Stats target | Description
--------+---------+-----------+----------+---------+---------+--------------+-------------
a | integer | | | | plain | |
-Inherits: atacc1
+Inherits:
+ atacc1
DROP TABLE ATACC1, ATACC2;
CREATE TABLE ATACC1 (a int);
Column | Type | Collation | Nullable | Default | Storage | Stats target | Description
--------+---------+-----------+----------+---------+---------+--------------+-------------
a | integer | | | | plain | |
-Inherits: atacc1
+Inherits:
+ atacc1
DROP TABLE ATACC1, ATACC2;
CREATE TABLE ATACC1 (a int);
Column | Type | Collation | Nullable | Default | Storage | Stats target | Description
--------+---------+-----------+----------+---------+---------+--------------+-------------
a | integer | | | | plain | |
-Inherits: atacc1
+Inherits:
+ atacc1
CREATE TABLE ATACC3 (PRIMARY KEY (a)) INHERITS (ATACC1);
\d+ ATACC3
"atacc3_pkey" PRIMARY KEY, btree (a)
Not-null constraints:
"atacc3_a_not_null" NOT NULL "a"
-Inherits: atacc1
+Inherits:
+ atacc1
DROP TABLE ATACC1, ATACC2, ATACC3;
-- NOT NULL NO INHERIT is not possible on partitioned tables
a | integer | | not null | | plain | |
Not-null constraints:
"ditto" NOT NULL "a" (inherited)
-Inherits: atacc2
+Inherits:
+ atacc2
DROP TABLE ATACC1, ATACC2, ATACC3;
-- Can't have two constraints with the same name
b | integer | | not null | | plain | |
Not-null constraints:
"cnn_pk_b_not_null" NOT NULL "b" (inherited)
-Inherits: cnn_pk
+Inherits:
+ cnn_pk
ALTER TABLE cnn_pk DROP CONSTRAINT cnn_primarykey;
\d+ cnn_pk*
b | integer | | not null | | plain | |
Not-null constraints:
"cnn_pk_b_not_null" NOT NULL "b" (inherited)
-Inherits: cnn_pk
+Inherits:
+ cnn_pk
DROP TABLE cnn_pk, cnn_pk_child;
-- As above, but create the primary key ahead of time
b | integer | | not null | | plain | |
Not-null constraints:
"cnn_pk_b_not_null" NOT NULL "b" (inherited)
-Inherits: cnn_pk
+Inherits:
+ cnn_pk
ALTER TABLE cnn_pk DROP CONSTRAINT cnn_primarykey;
\d+ cnn_pk*
b | integer | | not null | | plain | |
Not-null constraints:
"cnn_pk_b_not_null" NOT NULL "b" (inherited)
-Inherits: cnn_pk
+Inherits:
+ cnn_pk
DROP TABLE cnn_pk, cnn_pk_child;
-- As above, but create the primary key using a UNIQUE index
b | integer | | not null | | plain | |
Not-null constraints:
"cnn_pk_b_not_null" NOT NULL "b" (inherited)
-Inherits: cnn_pk
+Inherits:
+ cnn_pk
DROP TABLE cnn_pk, cnn_pk_child;
-- Unique constraints don't give raise to not-null constraints, however.
a | integer | | not null | | plain | |
Not-null constraints:
"notnull_tbl4_a_not_null" NOT NULL "a" (inherited)
-Inherits: notnull_tbl4
+Inherits:
+ notnull_tbl4
\d+ notnull_tbl4_cld2
Table "public.notnull_tbl4_cld2"
"notnull_tbl4_cld2_pkey" PRIMARY KEY, btree (a) DEFERRABLE
Not-null constraints:
"notnull_tbl4_cld2_a_not_null" NOT NULL "a" (local, inherited)
-Inherits: notnull_tbl4
+Inherits:
+ notnull_tbl4
\d+ notnull_tbl4_cld3
Table "public.notnull_tbl4_cld3"
"notnull_tbl4_cld3_pkey" PRIMARY KEY, btree (a) DEFERRABLE
Not-null constraints:
"a_nn" NOT NULL "a" (local, inherited)
-Inherits: notnull_tbl4
+Inherits:
+ notnull_tbl4
-- leave these tables around for pg_upgrade testing
-- It's possible to remove a constraint from parents without affecting children
Not-null constraints:
"ann" NOT NULL "a"
"bnn" NOT NULL "b"
-Inherits: notnull_tbl5
+Inherits:
+ notnull_tbl5
CREATE TABLE notnull_tbl6 (a int CONSTRAINT ann NOT NULL,
b int CONSTRAINT bnn NOT NULL, check (a > 0)) PARTITION BY LIST (a);
Check constraints:
"test_like_4_a_check" CHECK (a > 0)
"test_like_5x_p_check" CHECK (p > 0)
-Inherits: test_like_5,
- test_like_5x
+Inherits:
+ test_like_5
+ test_like_5x
-- Test updating of column numbers in statistics expressions (bug #18468)
CREATE TABLE test_like_6 (a int, c text, b text);
"ctlt1_b_check" CHECK (length(b) > 100) NOT ENFORCED
Not-null constraints:
"ctlt1_a_not_null" NOT NULL "a" (local, inherited)
-Inherits: ctlt1
+Inherits:
+ ctlt1
SELECT description FROM pg_description, pg_constraint c WHERE classoid = 'pg_constraint'::regclass AND objoid = c.oid AND c.conrelid = 'ctlt1_inh'::regclass;
description
"ctlt3_c_check" CHECK (length(c) < 7)
Not-null constraints:
"ctlt1_a_not_null" NOT NULL "a" (inherited)
-Inherits: ctlt1,
- ctlt3
+Inherits:
+ ctlt1
+ ctlt3
CREATE TABLE ctlt13_like (LIKE ctlt3 INCLUDING CONSTRAINTS INCLUDING INDEXES INCLUDING COMMENTS INCLUDING STORAGE) INHERITS (ctlt1);
NOTICE: merging column "a" with inherited definition
"ctlt3_c_check" CHECK (length(c) < 7)
Not-null constraints:
"ctlt1_a_not_null" NOT NULL "a" (inherited)
-Inherits: ctlt1
+Inherits:
+ ctlt1
SELECT description FROM pg_description, pg_constraint c WHERE classoid = 'pg_constraint'::regclass AND objoid = c.oid AND c.conrelid = 'ctlt13_like'::regclass;
description
"fd_pt1_c1_not_null" NOT NULL "c1" (inherited)
Server: s0
FDW options: (delimiter ',', quote '"', "be quoted" 'value')
-Inherits: fd_pt1
+Inherits:
+ fd_pt1
DROP FOREIGN TABLE ft2;
\d+ fd_pt1
"ft2_c1_not_null" NOT NULL "c1" (local, inherited)
Server: s0
FDW options: (delimiter ',', quote '"', "be quoted" 'value')
-Inherits: fd_pt1
+Inherits:
+ fd_pt1
CREATE TABLE ct3() INHERITS(ft2);
CREATE FOREIGN TABLE ft3 (
"ft2_c1_not_null" NOT NULL "c1" (local, inherited)
Server: s0
FDW options: (delimiter ',', quote '"', "be quoted" 'value')
-Inherits: fd_pt1
+Inherits:
+ fd_pt1
Child tables:
ct3
ft3, FOREIGN
c3 | date | | | | plain | |
Not-null constraints:
"ft2_c1_not_null" NOT NULL "c1" (inherited)
-Inherits: ft2
+Inherits:
+ ft2
\d+ ft3
Foreign table "public.ft3"
Not-null constraints:
"ft3_c1_not_null" NOT NULL "c1" (local, inherited)
Server: s0
-Inherits: ft2
+Inherits:
+ ft2
-- add attributes recursively
ALTER TABLE fd_pt1 ADD COLUMN c4 integer;
"fd_pt1_c7_not_null" NOT NULL "c7" (inherited)
Server: s0
FDW options: (delimiter ',', quote '"', "be quoted" 'value')
-Inherits: fd_pt1
+Inherits:
+ fd_pt1
Child tables:
ct3
ft3, FOREIGN
Not-null constraints:
"ft2_c1_not_null" NOT NULL "c1" (inherited)
"fd_pt1_c7_not_null" NOT NULL "c7" (inherited)
-Inherits: ft2
+Inherits:
+ ft2
\d+ ft3
Foreign table "public.ft3"
"ft3_c1_not_null" NOT NULL "c1" (local, inherited)
"fd_pt1_c7_not_null" NOT NULL "c7" (inherited)
Server: s0
-Inherits: ft2
+Inherits:
+ ft2
-- alter attributes recursively
ALTER TABLE fd_pt1 ALTER COLUMN c4 SET DEFAULT 0;
"fd_pt1_c6_not_null" NOT NULL "c6" (inherited)
Server: s0
FDW options: (delimiter ',', quote '"', "be quoted" 'value')
-Inherits: fd_pt1
+Inherits:
+ fd_pt1
Child tables:
ct3
ft3, FOREIGN
"ft2_c1_not_null" NOT NULL "c1" (local, inherited)
Server: s0
FDW options: (delimiter ',', quote '"', "be quoted" 'value')
-Inherits: fd_pt1
+Inherits:
+ fd_pt1
Child tables:
ct3
ft3, FOREIGN
"ft2_c1_not_null" NOT NULL "c1" (local, inherited)
Server: s0
FDW options: (delimiter ',', quote '"', "be quoted" 'value')
-Inherits: fd_pt1
+Inherits:
+ fd_pt1
Child tables:
ct3
ft3, FOREIGN
"ft2_c1_not_null" NOT NULL "c1" (local, inherited)
Server: s0
FDW options: (delimiter ',', quote '"', "be quoted" 'value')
-Inherits: fd_pt1
+Inherits:
+ fd_pt1
-- drop constraints recursively
ALTER TABLE fd_pt1 DROP CONSTRAINT fd_pt1chk1 CASCADE;
"ft2_c1_not_null" NOT NULL "c1" (local, inherited)
Server: s0
FDW options: (delimiter ',', quote '"', "be quoted" 'value')
-Inherits: fd_pt1
+Inherits:
+ fd_pt1
-- VALIDATE CONSTRAINT need do nothing on foreign tables
ALTER TABLE fd_pt1 VALIDATE CONSTRAINT fd_pt1chk3;
"ft2_c1_not_null" NOT NULL "c1" (local, inherited)
Server: s0
FDW options: (delimiter ',', quote '"', "be quoted" 'value')
-Inherits: fd_pt1
+Inherits:
+ fd_pt1
-- changes name of an attribute recursively
ALTER TABLE fd_pt1 RENAME COLUMN c1 TO f1;
"ft2_c1_not_null" NOT NULL "f1" (local, inherited)
Server: s0
FDW options: (delimiter ',', quote '"', "be quoted" 'value')
-Inherits: fd_pt1
+Inherits:
+ fd_pt1
DROP TABLE fd_pt1 CASCADE;
NOTICE: drop cascades to foreign table ft2
--------+---------+-----------+----------+------------------------------------
a | integer | | not null |
b | integer | | | generated always as (a * 2) stored
-Inherits: gtest1
+Inherits:
+ gtest1
INSERT INTO gtest1_1 VALUES (4);
SELECT * FROM gtest1_1;
x | integer | | | | plain | |
Not-null constraints:
"gtest1_a_not_null" NOT NULL "a" (inherited)
-Inherits: gtest1
+Inherits:
+ gtest1
INSERT INTO gtestx (a, x) VALUES (11, 22);
SELECT * FROM gtest1;
a | integer | | not null |
b | integer | | | generated always as (x + 1) stored
x | integer | | |
-Inherits: gtest1,
- gtesty
+Inherits:
+ gtest1
+ gtesty
-- test correct handling of GENERATED column that's only in child
CREATE TABLE gtestp (f1 int);
--------+---------+-----------+----------+---------
a | integer | | |
b | integer | | |
-Inherits: gtest30
+Inherits:
+ gtest30
DROP TABLE gtest30 CASCADE;
NOTICE: drop cascades to table gtest30_1
--------+---------+-----------+----------+------------------------------------
a | integer | | |
b | integer | | | generated always as (a * 2) stored
-Inherits: gtest30
+Inherits:
+ gtest30
ALTER TABLE gtest30_1 ALTER COLUMN b DROP EXPRESSION; -- error
ERROR: cannot drop generation expression from inherited column
--------+---------+-----------+----------+-----------------------------
a | integer | | not null |
b | integer | | | generated always as (a * 2)
-Inherits: gtest1
+Inherits:
+ gtest1
INSERT INTO gtest1_1 VALUES (4);
SELECT * FROM gtest1_1;
x | integer | | | | plain | |
Not-null constraints:
"gtest1_a_not_null" NOT NULL "a" (inherited)
-Inherits: gtest1
+Inherits:
+ gtest1
INSERT INTO gtestx (a, x) VALUES (11, 22);
SELECT * FROM gtest1;
a | integer | | not null |
b | integer | | | generated always as (x + 1)
x | integer | | |
-Inherits: gtest1,
- gtesty
+Inherits:
+ gtest1
+ gtesty
-- test correct handling of GENERATED column that's only in child
CREATE TABLE gtestp (f1 int);
--------+---------+-----------+----------+-----------------------------
a | integer | | |
b | integer | | | generated always as (a * 2)
-Inherits: gtest30
+Inherits:
+ gtest30
DROP TABLE gtest30 CASCADE;
NOTICE: drop cascades to table gtest30_1
--------+---------+-----------+----------+-----------------------------
a | integer | | |
b | integer | | | generated always as (a * 2)
-Inherits: gtest30
+Inherits:
+ gtest30
ALTER TABLE gtest30_1 ALTER COLUMN b DROP EXPRESSION; -- error
ERROR: cannot drop generation expression from inherited column
ff1 | integer | | |
Check constraints:
"p2chk" CHECK (ff1 > 10)
-Inherits: p1
+Inherits:
+ p1
-- Test that child does not override inheritable constraints of the parent
create table c2 (constraint p2chk check (ff1 > 10) no inherit) inherits (p1); --fails
f3 | integer | | |
Check constraints:
"p2_f2_check" CHECK (f2 > 0)
-Inherits: p1,
- p2
+Inherits:
+ p1
+ p2
create table c3 (f4 int) inherits(c1,c2);
NOTICE: merging multiple inherited definitions of column "f1"
f4 | integer | | |
Check constraints:
"p2_f2_check" CHECK (f2 > 0)
-Inherits: c1,
- c2
+Inherits:
+ c1
+ c2
drop table p1 cascade;
NOTICE: drop cascades to 3 other objects
a1 | integer | | |
Check constraints:
"pp1_a1_check" CHECK (a1 > 0)
-Inherits: pp1
+Inherits:
+ pp1
create table cc2(f4 float) inherits(pp1,cc1);
NOTICE: merging multiple inherited definitions of column "f1"
f4 | double precision | | |
Check constraints:
"pp1_a1_check" CHECK (a1 > 0)
-Inherits: pp1,
- cc1
+Inherits:
+ pp1
+ cc1
alter table pp1 add column a2 int check (a2 > 0);
NOTICE: merging definition of column "a2" for child "cc2"
Check constraints:
"pp1_a1_check" CHECK (a1 > 0)
"pp1_a2_check" CHECK (a2 > 0)
-Inherits: pp1,
- cc1
+Inherits:
+ pp1
+ cc1
drop table pp1 cascade;
NOTICE: drop cascades to 2 other objects
b | integer | | | | plain | |
c | integer | | | | plain | |
dd | integer | | | | plain | |
-Inherits: inht1,
- inhs1
+Inherits:
+ inht1
+ inhs1
DROP TABLE inhts;
-- Test for adding a column to a parent table with complex inheritance
--------+---------+-----------+----------+---------+---------+--------------+-------------
i | integer | | | | plain | |
j | bigint | | | 1 | plain | |
-Inherits: inhta,
- inhtb,
- inhtc
+Inherits:
+ inhta
+ inhtb
+ inhtc
DROP TABLE inhta, inhtb, inhtc, inhtd;
-- Test for renaming in diamond inheritance
x | integer | | | | plain | |
y | integer | | | | plain | |
z | integer | | | | plain | |
-Inherits: inht2,
- inht3
+Inherits:
+ inht2
+ inht3
CREATE TABLE inhts (d int) INHERITS (inht2, inhs1);
NOTICE: merging multiple inherited definitions of column "b"
x | integer | | | | plain | |
c | integer | | | | plain | |
d | integer | | | | plain | |
-Inherits: inht2,
- inhs1
+Inherits:
+ inht2
+ inhs1
WITH RECURSIVE r AS (
SELECT 'inht1'::regclass AS inhrelid
id | integer | | | | plain | |
val1 | character varying | | | | extended | |
val2 | integer | | | | plain | |
-Inherits: test_constraints
+Inherits:
+ test_constraints
DROP TABLE test_constraints_inh;
DROP TABLE test_constraints;
Column | Type | Collation | Nullable | Default | Storage | Stats target | Description
--------+--------+-----------+----------+---------+---------+--------------+-------------
c | circle | | | | plain | |
-Inherits: test_ex_constraints
+Inherits:
+ test_ex_constraints
DROP TABLE test_ex_constraints_inh;
DROP TABLE test_ex_constraints;
Column | Type | Collation | Nullable | Default | Storage | Stats target | Description
--------+---------+-----------+----------+---------+---------+--------------+-------------
id1 | integer | | | | plain | |
-Inherits: test_foreign_constraints
+Inherits:
+ test_foreign_constraints
DROP TABLE test_foreign_constraints_inh;
DROP TABLE test_foreign_constraints;
f1 | integer | | |
Check constraints:
"f1_pos" CHECK (f1 > 0)
-Inherits: p1
+Inherits:
+ p1
drop table p1 cascade;
NOTICE: drop cascades to table p1_c1
Column | Type | Collation | Nullable | Default
--------+---------+-----------+----------+---------
f1 | integer | | |
-Inherits: p1,
- p2
+Inherits:
+ p1
+ p2
Table "public.p1p2_c2"
Column | Type | Collation | Nullable | Default
f1 | integer | | |
Check constraints:
"f1_pos" CHECK (f1 > 0)
-Inherits: p1,
- p2
+Inherits:
+ p1
+ p2
drop table p1, p2 cascade;
NOTICE: drop cascades to 2 other objects
f1 | integer | | |
Check constraints:
"f1_pos" CHECK (f1 > 0)
-Inherits: p1_c1,
- p1_c2
+Inherits:
+ p1_c1
+ p1_c2
alter table p1 drop constraint f1_pos;
\d p1_c1c2
Column | Type | Collation | Nullable | Default
--------+---------+-----------+----------+---------
f1 | integer | | |
-Inherits: p1_c1,
- p1_c2
+Inherits:
+ p1_c1
+ p1_c2
drop table p1 cascade;
NOTICE: drop cascades to 3 other objects
Column | Type | Collation | Nullable | Default
--------+---------+-----------+----------+---------
f1 | integer | | |
-Inherits: p1_c1,
- p1_c2,
- p1
+Inherits:
+ p1_c1
+ p1_c2
+ p1
drop table p1 cascade;
NOTICE: drop cascades to 3 other objects
f4 | double precision | | | | plain | |
Not-null constraints:
"pp1_f1_not_null" NOT NULL "f1" (inherited)
-Inherits: pp1,
- cc1,
- cc2
+Inherits:
+ pp1
+ cc1
+ cc2
alter table cc3 no inherit pp1;
alter table cc3 no inherit cc1;
Not-null constraints:
"pp1_f1_not_null" NOT NULL "f1" (inherited)
"nn" NOT NULL "a2"
-Inherits: pp1
+Inherits:
+ pp1
Child tables:
cc2
Not-null constraints:
"pp1_f1_not_null" NOT NULL "f1" (inherited)
"nn" NOT NULL "a2" (inherited)
-Inherits: pp1,
- cc1
+Inherits:
+ pp1
+ cc1
alter table pp1 alter column f1 set not null;
\d+ pp1
Not-null constraints:
"pp1_f1_not_null" NOT NULL "f1" (inherited)
"nn" NOT NULL "a2"
-Inherits: pp1
+Inherits:
+ pp1
Child tables:
cc2
Not-null constraints:
"pp1_f1_not_null" NOT NULL "f1" (inherited)
"nn" NOT NULL "a2" (inherited)
-Inherits: pp1,
- cc1
+Inherits:
+ pp1
+ cc1
-- cannot create table with inconsistent NO INHERIT constraint
create table cc3 (a2 int not null no inherit) inherits (cc1);
a2 | integer | | | | plain | |
Not-null constraints:
"pp1_f1_not_null" NOT NULL "f1" (inherited)
-Inherits: pp1
+Inherits:
+ pp1
Child tables:
cc2
a2 | integer | | | | plain | |
Not-null constraints:
"pp1_f1_not_null" NOT NULL "f1" (inherited)
-Inherits: pp1,
- cc1
+Inherits:
+ pp1
+ cc1
-- remove from cc1, should fail again
alter table cc1 alter column f1 drop not null;
f2 | text | | | | extended | |
f3 | integer | | | | plain | |
f4 | double precision | | | | plain | |
-Inherits: inh_pp1,
- inh_cc1
+Inherits:
+ inh_pp1
+ inh_cc1
drop table inh_pp1, inh_cc1, inh_cc2;
-- Test a not-null addition that must walk down the hierarchy
Not-null constraints:
"nn" NOT NULL "a" (inherited)
"inh_child1_b_not_null" NOT NULL "b" (inherited)
-Inherits: inh_parent1,
- inh_parent2
+Inherits:
+ inh_parent1
+ inh_parent2
create table inh_child2 (constraint foo not null a) inherits (inh_parent1, inh_parent2);
alter table inh_child2 no inherit inh_parent2;
Not-null constraints:
"foo" NOT NULL "a" (local, inherited)
"nn" NOT NULL "b"
-Inherits: inh_parent1
+Inherits:
+ inh_parent1
drop table inh_parent1, inh_parent2, inh_child1, inh_child2;
-- Test multiple parents with overlapping primary keys
"inh_parent1_a_not_null" NOT NULL "a" (inherited)
"inh_parent1_b_not_null" NOT NULL "b" (inherited)
"inh_parent2_d_not_null" NOT NULL "d" (inherited)
-Inherits: inh_parent1,
- inh_parent2
+Inherits:
+ inh_parent1
+ inh_parent2
drop table inh_parent1, inh_parent2, inh_child;
-- NOT NULL NO INHERIT
Column | Type | Collation | Nullable | Default | Storage | Stats target | Description
--------+---------+-----------+----------+---------+---------+--------------+-------------
a | integer | | | | plain | |
-Inherits: inh_nn_parent
+Inherits:
+ inh_nn_parent
Table "public.inh_nn_child2"
Column | Type | Collation | Nullable | Default | Storage | Stats target | Description
--------+---------+-----------+----------+---------+---------+--------------+-------------
a | integer | | | | plain | |
-Inherits: inh_nn_parent
+Inherits:
+ inh_nn_parent
Table "public.inh_nn_parent"
Column | Type | Collation | Nullable | Default | Storage | Stats target | Description
f1 | integer | | not null | | plain | |
Not-null constraints:
"inh_child1_f1_not_null" NOT NULL "f1" (local, inherited)
-Inherits: inh_parent
+Inherits:
+ inh_parent
Child tables:
inh_child2
f1 | integer | | not null | | plain | |
Not-null constraints:
"inh_child2_f1_not_null" NOT NULL "f1" (local, inherited)
-Inherits: inh_child1
+Inherits:
+ inh_child1
select conrelid::regclass, conname, contype, coninhcount, conislocal
from pg_constraint where contype = 'n' and
f1 | integer | | not null | | plain | |
Not-null constraints:
"inh_child2_f1_not_null" NOT NULL "f1" (local, inherited)
-Inherits: inh_child1
+Inherits:
+ inh_child1
select conrelid::regclass, conname, contype, coninhcount, conislocal
from pg_constraint where contype = 'n' and
a | integer | | | | plain | |
Triggers:
parenttrig AFTER INSERT ON child FOR EACH ROW EXECUTE FUNCTION f()
-Inherits: parent
+Inherits:
+ parent
drop table parent, child;
drop function f();
----------+-----------+-----------+----------+---------
id | int4range | | not null |
valid_at | daterange | | not null |
-Inherits: temporal_rng
+Inherits:
+ temporal_rng
DROP TABLE temporal_rng2;
DROP TABLE temporal_rng;
valid_at | daterange | | not null |
Indexes:
"temporal_rng_pk" PRIMARY KEY (id, valid_at WITHOUT OVERLAPS)
-Inherits: temporal_rng
+Inherits:
+ temporal_rng
DROP TABLE temporal_rng CASCADE;
NOTICE: drop cascades to table temporal_rng2
valid_at | daterange | | not null |
Indexes:
"temporal_rng_pk" PRIMARY KEY (id, valid_at WITHOUT OVERLAPS)
-Inherits: temporal_rng
+Inherits:
+ temporal_rng
DROP TABLE temporal_rng2;
DROP TABLE temporal_rng;