diff options
| author | Peter Eisentraut | 2024-02-20 10:10:59 +0000 |
|---|---|---|
| committer | Peter Eisentraut | 2024-02-20 10:10:59 +0000 |
| commit | 74563f6b90216180fc13649725179fc119dddeb5 (patch) | |
| tree | db420dbac5843e3ba963da90447b0b0533515a79 /src/test | |
| parent | d2ca9a50b5b99ef29aa65b68b5e6ddb253fbb04a (diff) | |
Revert "Improve compression and storage support with inheritance"
This reverts commit 0413a556990ba628a3de8a0b58be020fd9a14ed0.
pg_dump cannot currently dump all the structures that are allowed by
this patch. This needs more work in pg_dump and more test coverage.
Discussion: https://www.postgresql.org/message-id/flat/24656cec-d6ef-4d15-8b5b-e8dfc9c833a7@eisentraut.org
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/regress/expected/compression.out | 101 | ||||
| -rw-r--r-- | src/test/regress/expected/compression_1.out | 111 | ||||
| -rw-r--r-- | src/test/regress/expected/create_table_like.out | 12 | ||||
| -rw-r--r-- | src/test/regress/expected/inherit.out | 38 | ||||
| -rw-r--r-- | src/test/regress/sql/compression.sql | 43 | ||||
| -rw-r--r-- | src/test/regress/sql/create_table_like.sql | 2 | ||||
| -rw-r--r-- | src/test/regress/sql/inherit.sql | 20 |
7 files changed, 23 insertions, 304 deletions
diff --git a/src/test/regress/expected/compression.out b/src/test/regress/expected/compression.out index c22a71f8bd4..834b7555cbc 100644 --- a/src/test/regress/expected/compression.out +++ b/src/test/regress/expected/compression.out @@ -223,102 +223,15 @@ SELECT pg_column_compression(f1) FROM cmpart2; pglz (1 row) --- test compression with inheritance -CREATE TABLE cmparent1 (f1 TEXT COMPRESSION pglz); -INSERT INTO cmparent1 VALUES ('cmparent1_' || repeat('1234567890', 1000)); -CREATE TABLE cmparent2 (f1 TEXT COMPRESSION lz4); -INSERT INTO cmparent2 VALUES ('cmparent2_' || repeat('1234567890', 1000)); -CREATE TABLE ncmparent (f1 TEXT); -- parent without compression -INSERT INTO ncmparent VALUES ('ncmparent_' || repeat('1234567890', 1000)); -CREATE TABLE cminh1(f1 TEXT) INHERITS(cmparent1); -NOTICE: merging column "f1" with inherited definition -INSERT INTO cminh1 VALUES ('cminh1_' || repeat('1234567890', 1000)); -CREATE TABLE cminh2(f1 TEXT) INHERITS(ncmparent, cmparent1); -NOTICE: merging multiple inherited definitions of column "f1" -NOTICE: merging column "f1" with inherited definition -INSERT INTO cminh2 VALUES ('cminh2_' || repeat('1234567890', 1000)); -CREATE TABLE cminh3(f1 TEXT) INHERITS(cmparent1, ncmparent); -NOTICE: merging multiple inherited definitions of column "f1" -NOTICE: merging column "f1" with inherited definition -INSERT INTO cminh3 VALUES ('cminh3_' || repeat('1234567890', 1000)); --- conflicting compression methods from parents -CREATE TABLE cminh() INHERITS(cmparent1, cmparent2); --error -NOTICE: merging multiple inherited definitions of column "f1" -ERROR: column "f1" inherits conflicting compression methods -HINT: To resolve the conflict, specify a compression method explicitly. -CREATE TABLE cminh(f1 TEXT) INHERITS(cmparent1, cmparent2); --error +-- test compression with inheritance, error +CREATE TABLE cminh() INHERITS(cmdata, cmdata1); NOTICE: merging multiple inherited definitions of column "f1" +ERROR: column "f1" has a compression method conflict +DETAIL: pglz versus lz4 +CREATE TABLE cminh(f1 TEXT COMPRESSION lz4) INHERITS(cmdata); NOTICE: merging column "f1" with inherited definition -ERROR: column "f1" inherits conflicting compression methods -HINT: To resolve the conflict, specify a compression method explicitly. --- child compression specification takes precedence, even if parent's --- compression conflict -CREATE TABLE cminh4(f1 TEXT COMPRESSION lz4) INHERITS(cmparent1); -NOTICE: merging column "f1" with inherited definition -INSERT INTO cminh4 VALUES ('cminh4_' || repeat('1234567890', 1000)); -CREATE TABLE cminh5(f1 TEXT COMPRESSION pglz) INHERITS(cmparent1, cmparent2); -NOTICE: merging multiple inherited definitions of column "f1" -NOTICE: merging column "f1" with inherited definition -INSERT INTO cminh5 VALUES ('cminh5_' || repeat('1234567890', 1000)); -SELECT tableoid::regclass, pg_column_compression(f1) FROM cmparent1; - tableoid | pg_column_compression ------------+----------------------- - cmparent1 | pglz - cminh1 | pglz - cminh2 | pglz - cminh3 | pglz - cminh4 | lz4 - cminh5 | pglz -(6 rows) - -SELECT tableoid::regclass, pg_column_compression(f1) FROM cmparent2; - tableoid | pg_column_compression ------------+----------------------- - cmparent2 | lz4 - cminh5 | pglz -(2 rows) - -SELECT tableoid::regclass, pg_column_compression(f1) FROM ncmparent; - tableoid | pg_column_compression ------------+----------------------- - ncmparent | pglz - cminh2 | pglz - cminh3 | pglz -(3 rows) - --- ALTER compression specification in child -ALTER TABLE cminh1 ALTER COLUMN f1 SET COMPRESSION lz4; -INSERT INTO cminh1 VALUES ('cminh1_lz4_' || repeat('1234567890', 1000)); -SELECT pg_column_compression(f1) FROM cminh1; - pg_column_compression ------------------------ - pglz - lz4 -(2 rows) - --- INHERIT through ALTER TABLE -CREATE TABLE cminh6 (f1 TEXT); -INSERT INTO cminh6 VALUES ('cminh6_' || repeat('1234567890', 1000)); -ALTER TABLE cminh6 INHERIT cmparent1; -INSERT INTO cminh6 VALUES ('cminh6_inh_' || repeat('1234567890', 1000)); -SELECT pg_column_compression(f1) FROM cminh6; - pg_column_compression ------------------------ - pglz - pglz -(2 rows) - -CREATE TABLE cminh7 (f1 TEXT COMPRESSION lz4); -INSERT INTO cminh7 VALUES ('cminh7_' || repeat('1234567890', 1000)); -ALTER TABLE cminh7 INHERIT cmparent1; -INSERT INTO cminh7 VALUES ('cminh7_inh_' || repeat('1234567890', 1000)); -SELECT pg_column_compression(f1) FROM cminh7; - pg_column_compression ------------------------ - lz4 - lz4 -(2 rows) - +ERROR: column "f1" has a compression method conflict +DETAIL: pglz versus lz4 -- test default_toast_compression GUC SET default_toast_compression = ''; ERROR: invalid value for parameter "default_toast_compression": "" diff --git a/src/test/regress/expected/compression_1.out b/src/test/regress/expected/compression_1.out index d70155d5d01..ddcd137c495 100644 --- a/src/test/regress/expected/compression_1.out +++ b/src/test/regress/expected/compression_1.out @@ -216,112 +216,13 @@ SELECT pg_column_compression(f1) FROM cmpart2; ----------------------- (0 rows) --- test compression with inheritance -CREATE TABLE cmparent1 (f1 TEXT COMPRESSION pglz); -INSERT INTO cmparent1 VALUES ('cmparent1_' || repeat('1234567890', 1000)); -CREATE TABLE cmparent2 (f1 TEXT COMPRESSION lz4); -ERROR: compression method lz4 not supported -DETAIL: This functionality requires the server to be built with lz4 support. -INSERT INTO cmparent2 VALUES ('cmparent2_' || repeat('1234567890', 1000)); -ERROR: relation "cmparent2" does not exist -LINE 1: INSERT INTO cmparent2 VALUES ('cmparent2_' || repeat('123456... - ^ -CREATE TABLE ncmparent (f1 TEXT); -- parent without compression -INSERT INTO ncmparent VALUES ('ncmparent_' || repeat('1234567890', 1000)); -CREATE TABLE cminh1(f1 TEXT) INHERITS(cmparent1); -NOTICE: merging column "f1" with inherited definition -INSERT INTO cminh1 VALUES ('cminh1_' || repeat('1234567890', 1000)); -CREATE TABLE cminh2(f1 TEXT) INHERITS(ncmparent, cmparent1); -NOTICE: merging multiple inherited definitions of column "f1" -NOTICE: merging column "f1" with inherited definition -INSERT INTO cminh2 VALUES ('cminh2_' || repeat('1234567890', 1000)); -CREATE TABLE cminh3(f1 TEXT) INHERITS(cmparent1, ncmparent); -NOTICE: merging multiple inherited definitions of column "f1" -NOTICE: merging column "f1" with inherited definition -INSERT INTO cminh3 VALUES ('cminh3_' || repeat('1234567890', 1000)); --- conflicting compression methods from parents -CREATE TABLE cminh() INHERITS(cmparent1, cmparent2); --error -ERROR: relation "cmparent2" does not exist -CREATE TABLE cminh(f1 TEXT) INHERITS(cmparent1, cmparent2); --error -ERROR: relation "cmparent2" does not exist --- child compression specification takes precedence, even if parent's --- compression conflict -CREATE TABLE cminh4(f1 TEXT COMPRESSION lz4) INHERITS(cmparent1); +-- test compression with inheritance, error +CREATE TABLE cminh() INHERITS(cmdata, cmdata1); +ERROR: relation "cmdata1" does not exist +CREATE TABLE cminh(f1 TEXT COMPRESSION lz4) INHERITS(cmdata); NOTICE: merging column "f1" with inherited definition -ERROR: compression method lz4 not supported -DETAIL: This functionality requires the server to be built with lz4 support. -INSERT INTO cminh4 VALUES ('cminh4_' || repeat('1234567890', 1000)); -ERROR: relation "cminh4" does not exist -LINE 1: INSERT INTO cminh4 VALUES ('cminh4_' || repeat('1234567890',... - ^ -CREATE TABLE cminh5(f1 TEXT COMPRESSION pglz) INHERITS(cmparent1, cmparent2); -ERROR: relation "cmparent2" does not exist -INSERT INTO cminh5 VALUES ('cminh5_' || repeat('1234567890', 1000)); -ERROR: relation "cminh5" does not exist -LINE 1: INSERT INTO cminh5 VALUES ('cminh5_' || repeat('1234567890',... - ^ -SELECT tableoid::regclass, pg_column_compression(f1) FROM cmparent1; - tableoid | pg_column_compression ------------+----------------------- - cmparent1 | pglz - cminh1 | pglz - cminh2 | pglz - cminh3 | pglz -(4 rows) - -SELECT tableoid::regclass, pg_column_compression(f1) FROM cmparent2; -ERROR: relation "cmparent2" does not exist -LINE 1: ...ableoid::regclass, pg_column_compression(f1) FROM cmparent2; - ^ -SELECT tableoid::regclass, pg_column_compression(f1) FROM ncmparent; - tableoid | pg_column_compression ------------+----------------------- - ncmparent | pglz - cminh2 | pglz - cminh3 | pglz -(3 rows) - --- ALTER compression specification in child -ALTER TABLE cminh1 ALTER COLUMN f1 SET COMPRESSION lz4; -ERROR: compression method lz4 not supported -DETAIL: This functionality requires the server to be built with lz4 support. -INSERT INTO cminh1 VALUES ('cminh1_lz4_' || repeat('1234567890', 1000)); -SELECT pg_column_compression(f1) FROM cminh1; - pg_column_compression ------------------------ - pglz - pglz -(2 rows) - --- INHERIT through ALTER TABLE -CREATE TABLE cminh6 (f1 TEXT); -INSERT INTO cminh6 VALUES ('cminh6_' || repeat('1234567890', 1000)); -ALTER TABLE cminh6 INHERIT cmparent1; -INSERT INTO cminh6 VALUES ('cminh6_inh_' || repeat('1234567890', 1000)); -SELECT pg_column_compression(f1) FROM cminh6; - pg_column_compression ------------------------ - pglz - pglz -(2 rows) - -CREATE TABLE cminh7 (f1 TEXT COMPRESSION lz4); -ERROR: compression method lz4 not supported -DETAIL: This functionality requires the server to be built with lz4 support. -INSERT INTO cminh7 VALUES ('cminh7_' || repeat('1234567890', 1000)); -ERROR: relation "cminh7" does not exist -LINE 1: INSERT INTO cminh7 VALUES ('cminh7_' || repeat('1234567890',... - ^ -ALTER TABLE cminh7 INHERIT cmparent1; -ERROR: relation "cminh7" does not exist -INSERT INTO cminh7 VALUES ('cminh7_inh_' || repeat('1234567890', 1000)); -ERROR: relation "cminh7" does not exist -LINE 1: INSERT INTO cminh7 VALUES ('cminh7_inh_' || repeat('12345678... - ^ -SELECT pg_column_compression(f1) FROM cminh7; -ERROR: relation "cminh7" does not exist -LINE 1: SELECT pg_column_compression(f1) FROM cminh7; - ^ +ERROR: column "f1" has a compression method conflict +DETAIL: pglz versus lz4 -- test default_toast_compression GUC SET default_toast_compression = ''; ERROR: invalid value for parameter "default_toast_compression": "" diff --git a/src/test/regress/expected/create_table_like.out b/src/test/regress/expected/create_table_like.out index fb786d35a3e..61956773ffd 100644 --- a/src/test/regress/expected/create_table_like.out +++ b/src/test/regress/expected/create_table_like.out @@ -445,10 +445,12 @@ SELECT s.stxname, objsubid, description FROM pg_description, pg_statistic_ext s CREATE TABLE inh_error1 () INHERITS (ctlt1, ctlt4); NOTICE: merging multiple inherited definitions of column "a" -ERROR: column "a" inherits conflicting storage methods -HINT: To resolve the conflict, specify a storage method explicitly. -CREATE TABLE ctlt14_inh_like (LIKE ctlt4 INCLUDING STORAGE) INHERITS (ctlt1); +ERROR: inherited column "a" has a storage parameter conflict +DETAIL: MAIN versus EXTENDED +CREATE TABLE inh_error2 (LIKE ctlt4 INCLUDING STORAGE) INHERITS (ctlt1); NOTICE: merging column "a" with inherited definition +ERROR: column "a" has a storage parameter conflict +DETAIL: MAIN versus EXTENDED -- Check that LIKE isn't confused by a system catalog of the same name CREATE TABLE pg_attrdef (LIKE ctlt1 INCLUDING ALL); \d+ public.pg_attrdef @@ -491,9 +493,7 @@ Statistics objects: ROLLBACK; DROP TABLE ctlt1, ctlt2, ctlt3, ctlt4, ctlt12_storage, ctlt12_comments, ctlt1_inh, ctlt13_inh, ctlt13_like, ctlt_all, ctla, ctlb CASCADE; -NOTICE: drop cascades to 2 other objects -DETAIL: drop cascades to table inhe -drop cascades to table ctlt14_inh_like +NOTICE: drop cascades to table inhe -- LIKE must respect NO INHERIT property of constraints CREATE TABLE noinh_con_copy (a int CHECK (a > 0) NO INHERIT); CREATE TABLE noinh_con_copy1 (LIKE noinh_con_copy INCLUDING CONSTRAINTS); diff --git a/src/test/regress/expected/inherit.out b/src/test/regress/expected/inherit.out index 1e6cc8e9ba4..130a9242288 100644 --- a/src/test/regress/expected/inherit.out +++ b/src/test/regress/expected/inherit.out @@ -3419,41 +3419,3 @@ UPDATE errtst_parent SET partid = 30, data = data + 10 WHERE partid = 20; ERROR: no partition of relation "errtst_parent" found for row DETAIL: Partition key of the failing row contains (partid) = (30). DROP TABLE errtst_parent; --- storage and inheritance -CREATE TABLE stparent1 (a TEXT STORAGE plain); -CREATE TABLE stparent2 (a TEXT); --- child inherits parent's storage properties, if they do not conflict -CREATE TABLE stchild1 (a TEXT) INHERITS (stparent1); -NOTICE: merging column "a" with inherited definition -CREATE TABLE stchild2 (a TEXT) INHERITS (stparent1, stparent2); -NOTICE: merging multiple inherited definitions of column "a" -NOTICE: merging column "a" with inherited definition -ERROR: column "a" inherits conflicting storage methods -HINT: To resolve the conflict, specify a storage method explicitly. --- child overrides parent's storage properties even if they conflict -CREATE TABLE stchild3 (a TEXT STORAGE main) INHERITS (stparent1); -NOTICE: merging column "a" with inherited definition -CREATE TABLE stchild4 (a TEXT STORAGE main) INHERITS (stparent1, stparent2); -NOTICE: merging multiple inherited definitions of column "a" -NOTICE: merging column "a" with inherited definition --- child storage properties are not changed when inheriting after creation. -CREATE TABLE stchild5 (a TEXT); -ALTER TABLE stchild5 INHERIT stparent1; -CREATE TABLE stchild6 (a TEXT STORAGE main); -ALTER TABLE stchild6 INHERIT stparent1; -SELECT attrelid::regclass, attname, attstorage FROM pg_attribute - WHERE (attrelid::regclass::name like 'stparent%' - OR attrelid::regclass::name like 'stchild%') - and attname = 'a' - ORDER BY 1, 2; - attrelid | attname | attstorage ------------+---------+------------ - stparent1 | a | p - stparent2 | a | x - stchild1 | a | p - stchild3 | a | m - stchild4 | a | m - stchild5 | a | x - stchild6 | a | m -(7 rows) - diff --git a/src/test/regress/sql/compression.sql b/src/test/regress/sql/compression.sql index ad8e7afd2a5..7179a5002ec 100644 --- a/src/test/regress/sql/compression.sql +++ b/src/test/regress/sql/compression.sql @@ -93,46 +93,9 @@ INSERT INTO cmpart VALUES (repeat('123456789', 4004)); SELECT pg_column_compression(f1) FROM cmpart1; SELECT pg_column_compression(f1) FROM cmpart2; --- test compression with inheritance -CREATE TABLE cmparent1 (f1 TEXT COMPRESSION pglz); -INSERT INTO cmparent1 VALUES ('cmparent1_' || repeat('1234567890', 1000)); -CREATE TABLE cmparent2 (f1 TEXT COMPRESSION lz4); -INSERT INTO cmparent2 VALUES ('cmparent2_' || repeat('1234567890', 1000)); -CREATE TABLE ncmparent (f1 TEXT); -- parent without compression -INSERT INTO ncmparent VALUES ('ncmparent_' || repeat('1234567890', 1000)); -CREATE TABLE cminh1(f1 TEXT) INHERITS(cmparent1); -INSERT INTO cminh1 VALUES ('cminh1_' || repeat('1234567890', 1000)); -CREATE TABLE cminh2(f1 TEXT) INHERITS(ncmparent, cmparent1); -INSERT INTO cminh2 VALUES ('cminh2_' || repeat('1234567890', 1000)); -CREATE TABLE cminh3(f1 TEXT) INHERITS(cmparent1, ncmparent); -INSERT INTO cminh3 VALUES ('cminh3_' || repeat('1234567890', 1000)); --- conflicting compression methods from parents -CREATE TABLE cminh() INHERITS(cmparent1, cmparent2); --error -CREATE TABLE cminh(f1 TEXT) INHERITS(cmparent1, cmparent2); --error --- child compression specification takes precedence, even if parent's --- compression conflict -CREATE TABLE cminh4(f1 TEXT COMPRESSION lz4) INHERITS(cmparent1); -INSERT INTO cminh4 VALUES ('cminh4_' || repeat('1234567890', 1000)); -CREATE TABLE cminh5(f1 TEXT COMPRESSION pglz) INHERITS(cmparent1, cmparent2); -INSERT INTO cminh5 VALUES ('cminh5_' || repeat('1234567890', 1000)); -SELECT tableoid::regclass, pg_column_compression(f1) FROM cmparent1; -SELECT tableoid::regclass, pg_column_compression(f1) FROM cmparent2; -SELECT tableoid::regclass, pg_column_compression(f1) FROM ncmparent; --- ALTER compression specification in child -ALTER TABLE cminh1 ALTER COLUMN f1 SET COMPRESSION lz4; -INSERT INTO cminh1 VALUES ('cminh1_lz4_' || repeat('1234567890', 1000)); -SELECT pg_column_compression(f1) FROM cminh1; --- INHERIT through ALTER TABLE -CREATE TABLE cminh6 (f1 TEXT); -INSERT INTO cminh6 VALUES ('cminh6_' || repeat('1234567890', 1000)); -ALTER TABLE cminh6 INHERIT cmparent1; -INSERT INTO cminh6 VALUES ('cminh6_inh_' || repeat('1234567890', 1000)); -SELECT pg_column_compression(f1) FROM cminh6; -CREATE TABLE cminh7 (f1 TEXT COMPRESSION lz4); -INSERT INTO cminh7 VALUES ('cminh7_' || repeat('1234567890', 1000)); -ALTER TABLE cminh7 INHERIT cmparent1; -INSERT INTO cminh7 VALUES ('cminh7_inh_' || repeat('1234567890', 1000)); -SELECT pg_column_compression(f1) FROM cminh7; +-- test compression with inheritance, error +CREATE TABLE cminh() INHERITS(cmdata, cmdata1); +CREATE TABLE cminh(f1 TEXT COMPRESSION lz4) INHERITS(cmdata); -- test default_toast_compression GUC SET default_toast_compression = ''; diff --git a/src/test/regress/sql/create_table_like.sql b/src/test/regress/sql/create_table_like.sql index 9c5758a72b7..4929d373a2f 100644 --- a/src/test/regress/sql/create_table_like.sql +++ b/src/test/regress/sql/create_table_like.sql @@ -168,7 +168,7 @@ SELECT c.relname, objsubid, description FROM pg_description, pg_index i, pg_clas SELECT s.stxname, objsubid, description FROM pg_description, pg_statistic_ext s WHERE classoid = 'pg_statistic_ext'::regclass AND objoid = s.oid AND s.stxrelid = 'ctlt_all'::regclass ORDER BY s.stxname, objsubid; CREATE TABLE inh_error1 () INHERITS (ctlt1, ctlt4); -CREATE TABLE ctlt14_inh_like (LIKE ctlt4 INCLUDING STORAGE) INHERITS (ctlt1); +CREATE TABLE inh_error2 (LIKE ctlt4 INCLUDING STORAGE) INHERITS (ctlt1); -- Check that LIKE isn't confused by a system catalog of the same name CREATE TABLE pg_attrdef (LIKE ctlt1 INCLUDING ALL); diff --git a/src/test/regress/sql/inherit.sql b/src/test/regress/sql/inherit.sql index 6e629121aef..0ef9a61bc16 100644 --- a/src/test/regress/sql/inherit.sql +++ b/src/test/regress/sql/inherit.sql @@ -1354,23 +1354,3 @@ UPDATE errtst_parent SET partid = 0, data = data + 10 WHERE partid = 20; UPDATE errtst_parent SET partid = 30, data = data + 10 WHERE partid = 20; DROP TABLE errtst_parent; - --- storage and inheritance -CREATE TABLE stparent1 (a TEXT STORAGE plain); -CREATE TABLE stparent2 (a TEXT); --- child inherits parent's storage properties, if they do not conflict -CREATE TABLE stchild1 (a TEXT) INHERITS (stparent1); -CREATE TABLE stchild2 (a TEXT) INHERITS (stparent1, stparent2); --- child overrides parent's storage properties even if they conflict -CREATE TABLE stchild3 (a TEXT STORAGE main) INHERITS (stparent1); -CREATE TABLE stchild4 (a TEXT STORAGE main) INHERITS (stparent1, stparent2); --- child storage properties are not changed when inheriting after creation. -CREATE TABLE stchild5 (a TEXT); -ALTER TABLE stchild5 INHERIT stparent1; -CREATE TABLE stchild6 (a TEXT STORAGE main); -ALTER TABLE stchild6 INHERIT stparent1; -SELECT attrelid::regclass, attname, attstorage FROM pg_attribute - WHERE (attrelid::regclass::name like 'stparent%' - OR attrelid::regclass::name like 'stchild%') - and attname = 'a' - ORDER BY 1, 2; |
