diff options
author | Michael Paquier <michael@paquier.xyz> | 2018-07-01 20:20:06 +0900 |
---|---|---|
committer | Michael Paquier <michael@paquier.xyz> | 2018-07-01 20:20:06 +0900 |
commit | 9994013ff32cb8371aed8ba28fc262e0a8cb0b4b (patch) | |
tree | 05b8b0f74e36bc90222dc300e9943df92c4478ed /src | |
parent | c4309f4aeeae54e4c5281d68e29288af1d0d1ed2 (diff) | |
download | postgresql-9994013ff32cb8371aed8ba28fc262e0a8cb0b4b.tar.gz postgresql-9994013ff32cb8371aed8ba28fc262e0a8cb0b4b.zip |
Add tests for inheritance trees mixing permanent and temporary relations
While working on 1c7c317c and related things, which has clarified the
use of partitions with temporary tables, I have noticed that there could
be better coverage for inheritance trees mixing temporary and permanent
relations. A lot of cross-checks happen in MergeAttributes() which is
not designed for this purpose, so the tests added in this commit will
make sure that any kind of future refactoring will limit the amount of
compatibility breakage.
Author: Michael Paquier
Reviewed-by: Ashutosh Bapat
Discussion: https://postgr.es/m/20180619022131.GE3314@paquier.xyz
Diffstat (limited to 'src')
-rw-r--r-- | src/test/regress/expected/inherit.out | 31 | ||||
-rw-r--r-- | src/test/regress/sql/inherit.sql | 17 |
2 files changed, 48 insertions, 0 deletions
diff --git a/src/test/regress/expected/inherit.out b/src/test/regress/expected/inherit.out index b2b912ed5c1..4f29d9f891c 100644 --- a/src/test/regress/expected/inherit.out +++ b/src/test/regress/expected/inherit.out @@ -1710,6 +1710,37 @@ select * from cnullparent where f1 = 2; drop table cnullparent cascade; NOTICE: drop cascades to table cnullchild -- +-- Check use of temporary tables with inheritance trees +-- +create table inh_perm_parent (a1 int); +create temp table inh_temp_parent (a1 int); +create temp table inh_temp_child () inherits (inh_perm_parent); -- ok +create table inh_perm_child () inherits (inh_temp_parent); -- error +ERROR: cannot inherit from temporary relation "inh_temp_parent" +create temp table inh_temp_child_2 () inherits (inh_temp_parent); -- ok +insert into inh_perm_parent values (1); +insert into inh_temp_parent values (2); +insert into inh_temp_child values (3); +insert into inh_temp_child_2 values (4); +select tableoid::regclass, a1 from inh_perm_parent; + tableoid | a1 +-----------------+---- + inh_perm_parent | 1 + inh_temp_child | 3 +(2 rows) + +select tableoid::regclass, a1 from inh_temp_parent; + tableoid | a1 +------------------+---- + inh_temp_parent | 2 + inh_temp_child_2 | 4 +(2 rows) + +drop table inh_perm_parent cascade; +NOTICE: drop cascades to table inh_temp_child +drop table inh_temp_parent cascade; +NOTICE: drop cascades to table inh_temp_child_2 +-- -- Check that constraint exclusion works correctly with partitions using -- implicit constraints generated from the partition bound information. -- diff --git a/src/test/regress/sql/inherit.sql b/src/test/regress/sql/inherit.sql index 5a48376fc03..a6e541d4dad 100644 --- a/src/test/regress/sql/inherit.sql +++ b/src/test/regress/sql/inherit.sql @@ -636,6 +636,23 @@ select * from cnullparent where f1 = 2; drop table cnullparent cascade; -- +-- Check use of temporary tables with inheritance trees +-- +create table inh_perm_parent (a1 int); +create temp table inh_temp_parent (a1 int); +create temp table inh_temp_child () inherits (inh_perm_parent); -- ok +create table inh_perm_child () inherits (inh_temp_parent); -- error +create temp table inh_temp_child_2 () inherits (inh_temp_parent); -- ok +insert into inh_perm_parent values (1); +insert into inh_temp_parent values (2); +insert into inh_temp_child values (3); +insert into inh_temp_child_2 values (4); +select tableoid::regclass, a1 from inh_perm_parent; +select tableoid::regclass, a1 from inh_temp_parent; +drop table inh_perm_parent cascade; +drop table inh_temp_parent cascade; + +-- -- Check that constraint exclusion works correctly with partitions using -- implicit constraints generated from the partition bound information. -- |