Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit964bae4

Browse files
committed
Add more tests for partition tuple routing with dropped attributes
As bug #15733 has proved, we are lacking coverage for partition tuplerouting with dropped attributes when involving three levels ofpartitioning or more. There was only an active bug in this area forv11, and HEAD is proving to handle those scenarios fine, still it lackedsome coverage for the previous problem.Author: Amit Langote, Michael PaquierDiscussion:https://postgr.es/m/15733-7692379e310b80ec@postgresql.org
1 parent80a96e0 commit964bae4

File tree

2 files changed

+69
-0
lines changed

2 files changed

+69
-0
lines changed

‎src/test/regress/expected/insert.out

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -629,6 +629,47 @@ select tableoid::regclass, * from mlparted_def;
629629
mlparted_defd | 70 | 100 |
630630
(4 rows)
631631

632+
-- Check multi-level tuple routing with attributes dropped from the
633+
-- top-most parent. First remove the last attribute.
634+
alter table mlparted add d int, add e int;
635+
alter table mlparted drop e;
636+
create table mlparted5 partition of mlparted
637+
for values from (1, 40) to (1, 50) partition by range (c);
638+
create table mlparted5_ab partition of mlparted5
639+
for values from ('a') to ('c') partition by list (c);
640+
create table mlparted5_a partition of mlparted5_ab for values in ('a');
641+
create table mlparted5_b (d int, b int, c text, a int);
642+
alter table mlparted5_ab attach partition mlparted5_b for values in ('b');
643+
truncate mlparted;
644+
insert into mlparted values (1, 2, 'a', 1);
645+
insert into mlparted values (1, 40, 'a', 1); -- goes to mlparted5_a
646+
insert into mlparted values (1, 45, 'b', 1); -- goes to mlparted5_b
647+
select tableoid::regclass, * from mlparted order by a, b, c, d;
648+
tableoid | a | b | c | d
649+
-------------+---+----+---+---
650+
mlparted11 | 1 | 2 | a | 1
651+
mlparted5_a | 1 | 40 | a | 1
652+
mlparted5_b | 1 | 45 | b | 1
653+
(3 rows)
654+
655+
alter table mlparted drop d;
656+
truncate mlparted;
657+
-- Remove the before last attribute.
658+
alter table mlparted add e int, add d int;
659+
alter table mlparted drop e;
660+
insert into mlparted values (1, 2, 'a', 1);
661+
insert into mlparted values (1, 40, 'a', 1); -- goes to mlparted5_a
662+
insert into mlparted values (1, 45, 'b', 1); -- goes to mlparted5_b
663+
select tableoid::regclass, * from mlparted order by a, b, c, d;
664+
tableoid | a | b | c | d
665+
-------------+---+----+---+---
666+
mlparted11 | 1 | 2 | a | 1
667+
mlparted5_a | 1 | 40 | a | 1
668+
mlparted5_b | 1 | 45 | b | 1
669+
(3 rows)
670+
671+
alter table mlparted drop d;
672+
drop table mlparted5;
632673
-- check that message shown after failure to find a partition shows the
633674
-- appropriate key description (or none) in various situations
634675
create table key_desc (a int, b int) partition by list ((a+0));

‎src/test/regress/sql/insert.sql

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -401,6 +401,34 @@ insert into mlparted values (70, 100);
401401

402402
select tableoid::regclass,*from mlparted_def;
403403

404+
-- Check multi-level tuple routing with attributes dropped from the
405+
-- top-most parent. First remove the last attribute.
406+
altertable mlparted add dint, add eint;
407+
altertable mlparted drop e;
408+
createtablemlparted5 partition of mlparted
409+
forvaluesfrom (1,40) to (1,50) partition by range (c);
410+
createtablemlparted5_ab partition of mlparted5
411+
forvaluesfrom ('a') to ('c') partition by list (c);
412+
createtablemlparted5_a partition of mlparted5_ab forvaluesin ('a');
413+
createtablemlparted5_b (dint, bint, ctext, aint);
414+
altertable mlparted5_ab attach partition mlparted5_b forvaluesin ('b');
415+
truncate mlparted;
416+
insert into mlpartedvalues (1,2,'a',1);
417+
insert into mlpartedvalues (1,40,'a',1);-- goes to mlparted5_a
418+
insert into mlpartedvalues (1,45,'b',1);-- goes to mlparted5_b
419+
select tableoid::regclass,*from mlpartedorder by a, b, c, d;
420+
altertable mlparted drop d;
421+
truncate mlparted;
422+
-- Remove the before last attribute.
423+
altertable mlparted add eint, add dint;
424+
altertable mlparted drop e;
425+
insert into mlpartedvalues (1,2,'a',1);
426+
insert into mlpartedvalues (1,40,'a',1);-- goes to mlparted5_a
427+
insert into mlpartedvalues (1,45,'b',1);-- goes to mlparted5_b
428+
select tableoid::regclass,*from mlpartedorder by a, b, c, d;
429+
altertable mlparted drop d;
430+
droptable mlparted5;
431+
404432
-- check that message shown after failure to find a partition shows the
405433
-- appropriate key description (or none) in various situations
406434
createtablekey_desc (aint, bint) partition by list ((a+0));

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp