diff options
author | Alvaro Herrera <alvherre@alvh.no-ip.org> | 2019-03-04 15:52:41 -0300 |
---|---|---|
committer | Alvaro Herrera <alvherre@alvh.no-ip.org> | 2019-03-04 15:52:41 -0300 |
commit | d12fbe2f8e5daf84b07a61884a8ea5f84d6c5832 (patch) | |
tree | 8c24b8293e6e3c7d5192d7b87fec8a6626d58b53 /src | |
parent | 278584b526d71a3fe86f91be5870f99f38477e27 (diff) | |
download | postgresql-d12fbe2f8e5daf84b07a61884a8ea5f84d6c5832.tar.gz postgresql-d12fbe2f8e5daf84b07a61884a8ea5f84d6c5832.zip |
Test partition functions with legacy inheritance children, too
It's worth immortalizing this behavior, per discussion.
Discussion: https://postgr.es/m/20190228193203.GA26151@alvherre.pgsql
Diffstat (limited to 'src')
-rw-r--r-- | src/test/regress/expected/partition_info.out | 29 | ||||
-rw-r--r-- | src/test/regress/sql/partition_info.sql | 11 |
2 files changed, 36 insertions, 4 deletions
diff --git a/src/test/regress/expected/partition_info.out b/src/test/regress/expected/partition_info.out index c1ba53d74d1..6df7a80a939 100644 --- a/src/test/regress/expected/partition_info.out +++ b/src/test/regress/expected/partition_info.out @@ -180,11 +180,13 @@ SELECT pg_partition_root('ptif_normal_table'); (1 row) DROP TABLE ptif_normal_table; --- Various partitioning-related functions return NULL if passed relations +-- Various partitioning-related functions return empty/NULL if passed relations -- of types that cannot be part of a partition tree; for example, views, --- materialized views, etc. +-- materialized views, legacy inheritance children or parents, etc. CREATE VIEW ptif_test_view AS SELECT 1; CREATE MATERIALIZED VIEW ptif_test_matview AS SELECT 1; +CREATE TABLE ptif_li_parent (); +CREATE TABLE ptif_li_child () INHERITS (ptif_li_parent); SELECT * FROM pg_partition_tree('ptif_test_view'); relid | parentrelid | isleaf | level -------+-------------+--------+------- @@ -195,6 +197,16 @@ SELECT * FROM pg_partition_tree('ptif_test_matview'); -------+-------------+--------+------- (0 rows) +SELECT * FROM pg_partition_tree('ptif_li_parent'); + relid | parentrelid | isleaf | level +-------+-------------+--------+------- +(0 rows) + +SELECT * FROM pg_partition_tree('ptif_li_child'); + relid | parentrelid | isleaf | level +-------+-------------+--------+------- +(0 rows) + SELECT pg_partition_root('ptif_test_view'); pg_partition_root ------------------- @@ -207,5 +219,18 @@ SELECT pg_partition_root('ptif_test_matview'); (1 row) +SELECT pg_partition_root('ptif_li_parent'); + pg_partition_root +------------------- + +(1 row) + +SELECT pg_partition_root('ptif_li_child'); + pg_partition_root +------------------- + +(1 row) + DROP VIEW ptif_test_view; DROP MATERIALIZED VIEW ptif_test_matview; +DROP TABLE ptif_li_parent, ptif_li_child; diff --git a/src/test/regress/sql/partition_info.sql b/src/test/regress/sql/partition_info.sql index 44a0abe7e21..a18c15aef21 100644 --- a/src/test/regress/sql/partition_info.sql +++ b/src/test/regress/sql/partition_info.sql @@ -84,14 +84,21 @@ SELECT relid, parentrelid, level, isleaf SELECT pg_partition_root('ptif_normal_table'); DROP TABLE ptif_normal_table; --- Various partitioning-related functions return NULL if passed relations +-- Various partitioning-related functions return empty/NULL if passed relations -- of types that cannot be part of a partition tree; for example, views, --- materialized views, etc. +-- materialized views, legacy inheritance children or parents, etc. CREATE VIEW ptif_test_view AS SELECT 1; CREATE MATERIALIZED VIEW ptif_test_matview AS SELECT 1; +CREATE TABLE ptif_li_parent (); +CREATE TABLE ptif_li_child () INHERITS (ptif_li_parent); SELECT * FROM pg_partition_tree('ptif_test_view'); SELECT * FROM pg_partition_tree('ptif_test_matview'); +SELECT * FROM pg_partition_tree('ptif_li_parent'); +SELECT * FROM pg_partition_tree('ptif_li_child'); SELECT pg_partition_root('ptif_test_view'); SELECT pg_partition_root('ptif_test_matview'); +SELECT pg_partition_root('ptif_li_parent'); +SELECT pg_partition_root('ptif_li_child'); DROP VIEW ptif_test_view; DROP MATERIALIZED VIEW ptif_test_matview; +DROP TABLE ptif_li_parent, ptif_li_child; |