Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 9994013

Browse files
committed
Add tests for inheritance trees mixing permanent and temporary relations
While working on 1c7c317 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
1 parent c4309f4 commit 9994013

File tree

2 files changed

+48
-0
lines changed

2 files changed

+48
-0
lines changed

src/test/regress/expected/inherit.out

+31
Original file line numberDiff line numberDiff line change
@@ -1710,6 +1710,37 @@ select * from cnullparent where f1 = 2;
17101710
drop table cnullparent cascade;
17111711
NOTICE: drop cascades to table cnullchild
17121712
--
1713+
-- Check use of temporary tables with inheritance trees
1714+
--
1715+
create table inh_perm_parent (a1 int);
1716+
create temp table inh_temp_parent (a1 int);
1717+
create temp table inh_temp_child () inherits (inh_perm_parent); -- ok
1718+
create table inh_perm_child () inherits (inh_temp_parent); -- error
1719+
ERROR: cannot inherit from temporary relation "inh_temp_parent"
1720+
create temp table inh_temp_child_2 () inherits (inh_temp_parent); -- ok
1721+
insert into inh_perm_parent values (1);
1722+
insert into inh_temp_parent values (2);
1723+
insert into inh_temp_child values (3);
1724+
insert into inh_temp_child_2 values (4);
1725+
select tableoid::regclass, a1 from inh_perm_parent;
1726+
tableoid | a1
1727+
-----------------+----
1728+
inh_perm_parent | 1
1729+
inh_temp_child | 3
1730+
(2 rows)
1731+
1732+
select tableoid::regclass, a1 from inh_temp_parent;
1733+
tableoid | a1
1734+
------------------+----
1735+
inh_temp_parent | 2
1736+
inh_temp_child_2 | 4
1737+
(2 rows)
1738+
1739+
drop table inh_perm_parent cascade;
1740+
NOTICE: drop cascades to table inh_temp_child
1741+
drop table inh_temp_parent cascade;
1742+
NOTICE: drop cascades to table inh_temp_child_2
1743+
--
17131744
-- Check that constraint exclusion works correctly with partitions using
17141745
-- implicit constraints generated from the partition bound information.
17151746
--

src/test/regress/sql/inherit.sql

+17
Original file line numberDiff line numberDiff line change
@@ -635,6 +635,23 @@ select * from cnullparent;
635635
select * from cnullparent where f1 = 2;
636636
drop table cnullparent cascade;
637637

638+
--
639+
-- Check use of temporary tables with inheritance trees
640+
--
641+
create table inh_perm_parent (a1 int);
642+
create temp table inh_temp_parent (a1 int);
643+
create temp table inh_temp_child () inherits (inh_perm_parent); -- ok
644+
create table inh_perm_child () inherits (inh_temp_parent); -- error
645+
create temp table inh_temp_child_2 () inherits (inh_temp_parent); -- ok
646+
insert into inh_perm_parent values (1);
647+
insert into inh_temp_parent values (2);
648+
insert into inh_temp_child values (3);
649+
insert into inh_temp_child_2 values (4);
650+
select tableoid::regclass, a1 from inh_perm_parent;
651+
select tableoid::regclass, a1 from inh_temp_parent;
652+
drop table inh_perm_parent cascade;
653+
drop table inh_temp_parent cascade;
654+
638655
--
639656
-- Check that constraint exclusion works correctly with partitions using
640657
-- implicit constraints generated from the partition bound information.

0 commit comments

Comments
 (0)