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

Commitd26fa4f

Browse files
committed
Add some more tests for tuple routing.
Commita256650 fixed some issues withhow PartitionDispatch related code handled multi-level partitionedtables, but didn't add any tests.Discussion:http://postgr.es/m/CA%2BTgmoZ86v1G%2Bzx9etMiSQaBBvYMKfU-iitqZArSh5z0n8Q4cA%40mail.gmail.comAmit Langote, per a complaint from me.
1 parent262e821 commitd26fa4f

File tree

2 files changed

+55
-1
lines changed

2 files changed

+55
-1
lines changed

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

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,34 @@ select tableoid::regclass, * from list_parted;
285285
part_ee_ff2 | EE | 10
286286
(8 rows)
287287

288+
-- some more tests to exercise tuple-routing with multi-level partitioning
289+
create table part_gg partition of list_parted for values in ('gg') partition by range (b);
290+
create table part_gg1 partition of part_gg for values from (unbounded) to (1);
291+
create table part_gg2 partition of part_gg for values from (1) to (10) partition by range (b);
292+
create table part_gg2_1 partition of part_gg2 for values from (1) to (5);
293+
create table part_gg2_2 partition of part_gg2 for values from (5) to (10);
294+
create table part_ee_ff3 partition of part_ee_ff for values from (20) to (30) partition by range (b);
295+
create table part_ee_ff3_1 partition of part_ee_ff3 for values from (20) to (25);
296+
create table part_ee_ff3_2 partition of part_ee_ff3 for values from (25) to (30);
297+
truncate list_parted;
298+
insert into list_parted values ('aa'), ('cc');
299+
insert into list_parted select 'Ff', s.a from generate_series(1, 29) s(a);
300+
insert into list_parted select 'gg', s.a from generate_series(1, 9) s(a);
301+
insert into list_parted (b) values (1);
302+
select tableoid::regclass::text, a, min(b) as min_b, max(b) as max_b from list_parted group by 1, 2 order by 1;
303+
tableoid | a | min_b | max_b
304+
---------------+----+-------+-------
305+
part_aa_bb | aa | |
306+
part_cc_dd | cc | |
307+
part_ee_ff1 | Ff | 1 | 9
308+
part_ee_ff2 | Ff | 10 | 19
309+
part_ee_ff3_1 | Ff | 20 | 24
310+
part_ee_ff3_2 | Ff | 25 | 29
311+
part_gg2_1 | gg | 1 | 4
312+
part_gg2_2 | gg | 5 | 9
313+
part_null | | 1 | 1
314+
(9 rows)
315+
288316
-- cleanup
289317
drop table range_parted cascade;
290318
NOTICE: drop cascades to 4 other objects
@@ -293,13 +321,21 @@ drop cascades to table part2
293321
drop cascades to table part3
294322
drop cascades to table part4
295323
drop table list_parted cascade;
296-
NOTICE: drop cascades to6 other objects
324+
NOTICE: drop cascades to14 other objects
297325
DETAIL: drop cascades to table part_aa_bb
298326
drop cascades to table part_cc_dd
299327
drop cascades to table part_null
300328
drop cascades to table part_ee_ff
301329
drop cascades to table part_ee_ff1
302330
drop cascades to table part_ee_ff2
331+
drop cascades to table part_ee_ff3
332+
drop cascades to table part_ee_ff3_1
333+
drop cascades to table part_ee_ff3_2
334+
drop cascades to table part_gg
335+
drop cascades to table part_gg1
336+
drop cascades to table part_gg2
337+
drop cascades to table part_gg2_1
338+
drop cascades to table part_gg2_2
303339
-- more tests for certain multi-level partitioning scenarios
304340
create table p (a int, b int) partition by range (a, b);
305341
create table p1 (b int, a int not null) partition by range (b);

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

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,24 @@ insert into list_parted values ('EE', 1);
167167
insert into part_ee_ffvalues ('EE',10);
168168
select tableoid::regclass,*from list_parted;
169169

170+
-- some more tests to exercise tuple-routing with multi-level partitioning
171+
createtablepart_gg partition of list_parted forvaluesin ('gg') partition by range (b);
172+
createtablepart_gg1 partition of part_gg forvaluesfrom (unbounded) to (1);
173+
createtablepart_gg2 partition of part_gg forvaluesfrom (1) to (10) partition by range (b);
174+
createtablepart_gg2_1 partition of part_gg2 forvaluesfrom (1) to (5);
175+
createtablepart_gg2_2 partition of part_gg2 forvaluesfrom (5) to (10);
176+
177+
createtablepart_ee_ff3 partition of part_ee_ff forvaluesfrom (20) to (30) partition by range (b);
178+
createtablepart_ee_ff3_1 partition of part_ee_ff3 forvaluesfrom (20) to (25);
179+
createtablepart_ee_ff3_2 partition of part_ee_ff3 forvaluesfrom (25) to (30);
180+
181+
truncate list_parted;
182+
insert into list_partedvalues ('aa'), ('cc');
183+
insert into list_partedselect'Ff',s.afrom generate_series(1,29) s(a);
184+
insert into list_partedselect'gg',s.afrom generate_series(1,9) s(a);
185+
insert into list_parted (b)values (1);
186+
select tableoid::regclass::text, a,min(b)as min_b,max(b)as max_bfrom list_partedgroup by1,2order by1;
187+
170188
-- cleanup
171189
droptable range_parted cascade;
172190
droptable list_parted cascade;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp