Skip to content

Commit d26fa4f

Browse files
committed
Add some more tests for tuple routing.
Commit a256650 fixed some issues with how PartitionDispatch related code handled multi-level partitioned tables, but didn't add any tests. Discussion: http://postgr.es/m/CA%2BTgmoZ86v1G%2Bzx9etMiSQaBBvYMKfU-iitqZArSh5z0n8Q4cA%40mail.gmail.com Amit Langote, per a complaint from me.
1 parent 262e821 commit d26fa4f

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 to 6 other objects
324+
NOTICE: drop cascades to 14 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_ff values ('EE', 10);
168168
select tableoid::regclass, * from list_parted;
169169

170+
-- some more tests to exercise tuple-routing with multi-level partitioning
171+
create table part_gg partition of list_parted for values in ('gg') partition by range (b);
172+
create table part_gg1 partition of part_gg for values from (unbounded) to (1);
173+
create table part_gg2 partition of part_gg for values from (1) to (10) partition by range (b);
174+
create table part_gg2_1 partition of part_gg2 for values from (1) to (5);
175+
create table part_gg2_2 partition of part_gg2 for values from (5) to (10);
176+
177+
create table part_ee_ff3 partition of part_ee_ff for values from (20) to (30) partition by range (b);
178+
create table part_ee_ff3_1 partition of part_ee_ff3 for values from (20) to (25);
179+
create table part_ee_ff3_2 partition of part_ee_ff3 for values from (25) to (30);
180+
181+
truncate list_parted;
182+
insert into list_parted values ('aa'), ('cc');
183+
insert into list_parted select 'Ff', s.a from generate_series(1, 29) s(a);
184+
insert into list_parted select 'gg', s.a from 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_b from list_parted group by 1, 2 order by 1;
187+
170188
-- cleanup
171189
drop table range_parted cascade;
172190
drop table list_parted cascade;

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy