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

Commitaa56671

Browse files
committed
Give partitioned table "p" in regression tests a less generic name.
And don't drop it, so that we improve the coverage of the pg_upgraderegression tests.Amit Langote, per a gripe from Tom LaneDiscussion:http://postgr.es/m/9071.1488863082@sss.pgh.pa.us
1 parentd88d06c commitaa56671

File tree

6 files changed

+95
-91
lines changed

6 files changed

+95
-91
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3371,3 +3371,4 @@ alter table p attach partition p1 for values from (1, 2) to (1, 10);
33713371
ERROR: partition constraint is violated by some row
33723372
-- cleanup
33733373
drop table p;
3374+
drop table p1;

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

Lines changed: 51 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -316,75 +316,75 @@ select tableoid::regclass::text, a, min(b) as min_b, max(b) as max_b from list_p
316316
-- cleanup
317317
drop table range_parted, list_parted;
318318
-- more tests for certain multi-level partitioning scenarios
319-
create tablep (a int, b int) partition by range (a, b);
320-
create tablep1 (b int not null, a int not null) partition by range ((b+0));
321-
create tablep11 (likep1);
322-
alter tablep11 drop a;
323-
alter tablep11 add a int;
324-
alter tablep11 drop a;
325-
alter tablep11 add a int not null;
326-
-- attnum for key attribute 'a' is different inp, p1, andp11
319+
create tablemlparted (a int, b int) partition by range (a, b);
320+
create tablemlparted1 (b int not null, a int not null) partition by range ((b+0));
321+
create tablemlparted11 (likemlparted1);
322+
alter tablemlparted11 drop a;
323+
alter tablemlparted11 add a int;
324+
alter tablemlparted11 drop a;
325+
alter tablemlparted11 add a int not null;
326+
-- attnum for key attribute 'a' is different inmlparted, mlparted1, andmlparted11
327327
select attrelid::regclass, attname, attnum
328328
from pg_attribute
329329
where attname = 'a'
330-
and (attrelid = 'p'::regclass
331-
or attrelid = 'p1'::regclass
332-
or attrelid = 'p11'::regclass)
330+
and (attrelid = 'mlparted'::regclass
331+
or attrelid = 'mlparted1'::regclass
332+
or attrelid = 'mlparted11'::regclass)
333333
order by attrelid::regclass::text;
334-
attrelid | attname | attnum
335-
----------+---------+--------
336-
p | a | 1
337-
p1 | a | 2
338-
p11 | a | 4
334+
attrelid | attname | attnum
335+
------------+---------+--------
336+
mlparted | a | 1
337+
mlparted1 | a | 2
338+
mlparted11 | a | 4
339339
(3 rows)
340340

341-
alter tablep1 attach partitionp11 for values from (2) to (5);
342-
alter tablep attach partitionp1 for values from (1, 2) to (1, 10);
343-
-- check that "(1, 2)" is correctly routed top11.
344-
insert intop values (1, 2);
345-
select tableoid::regclass, * fromp;
346-
tableoid | a | b
347-
----------+---+---
348-
p11 | 1 | 2
341+
alter tablemlparted1 attach partitionmlparted11 for values from (2) to (5);
342+
alter tablemlparted attach partitionmlparted1 for values from (1, 2) to (1, 10);
343+
-- check that "(1, 2)" is correctly routed tomlparted11.
344+
insert intomlparted values (1, 2);
345+
select tableoid::regclass, * frommlparted;
346+
tableoid | a | b
347+
------------+---+---
348+
mlparted11 | 1 | 2
349349
(1 row)
350350

351-
-- check that proper message is shown after failure to route throughp1
352-
insert intop (a, b) values (1, 5);
353-
ERROR: no partition of relation "p1" found for row
351+
-- check that proper message is shown after failure to route throughmlparted1
352+
insert intomlparted (a, b) values (1, 5);
353+
ERROR: no partition of relation "mlparted1" found for row
354354
DETAIL: Partition key of the failing row contains ((b + 0)) = (5).
355-
truncatep;
356-
alter tablep add constraint check_b check (b = 3);
357-
-- check that correct input row is shown when constraint check_b fails onp11
355+
truncatemlparted;
356+
alter tablemlparted add constraint check_b check (b = 3);
357+
-- check that correct input row is shown when constraint check_b fails onmlparted11
358358
-- after "(1, 2)" is routed to it
359-
insert intop values (1, 2);
360-
ERROR: new row for relation "p11" violates check constraint "check_b"
359+
insert intomlparted values (1, 2);
360+
ERROR: new row for relation "mlparted11" violates check constraint "check_b"
361361
DETAIL: Failing row contains (1, 2).
362362
-- check that inserting into an internal partition successfully results in
363363
-- checking its partition constraint before inserting into the leaf partition
364364
-- selected by tuple-routing
365-
insert intop1 (a, b) values (2, 3);
366-
ERROR: new row for relation "p11" violates partition constraint
365+
insert intomlparted1 (a, b) values (2, 3);
366+
ERROR: new row for relation "mlparted11" violates partition constraint
367367
DETAIL: Failing row contains (3, 2).
368368
-- check that RETURNING works correctly with tuple-routing
369-
alter tablep drop constraint check_b;
370-
create tablep12 partition ofp1 for values from (5) to (10);
371-
create tablep2 (b int not null, a int not null);
372-
alter tablep attach partitionp2 for values from (1, 10) to (1, 20);
373-
create tablep3 partition ofp for values from (1, 20) to (1, 30);
374-
create tablep4 (likep);
375-
alter tablep4 drop a;
376-
alter tablep4 add a int not null;
377-
alter tablep attach partitionp4 for values from (1, 30) to (1, 40);
369+
alter tablemlparted drop constraint check_b;
370+
create tablemlparted12 partition ofmlparted1 for values from (5) to (10);
371+
create tablemlparted2 (b int not null, a int not null);
372+
alter tablemlparted attach partitionmlparted2 for values from (1, 10) to (1, 20);
373+
create tablemlparted3 partition ofmlparted for values from (1, 20) to (1, 30);
374+
create tablemlparted4 (likemlparted);
375+
alter tablemlparted4 drop a;
376+
alter tablemlparted4 add a int not null;
377+
alter tablemlparted attach partitionmlparted4 for values from (1, 30) to (1, 40);
378378
with ins (a, b, c) as
379-
(insert intop (b, a) select s.a, 1 from generate_series(2, 39) s(a) returning tableoid::regclass, *)
379+
(insert intomlparted (b, a) select s.a, 1 from generate_series(2, 39) s(a) returning tableoid::regclass, *)
380380
select a, b, min(c), max(c) from ins group by a, b order by 1;
381-
a | b | min | max
382-
-----+---+-----+-----
383-
p11 | 1 | 2 | 4
384-
p12 | 1 | 5 | 9
385-
p2 | 1 | 10 | 19
386-
p3 | 1 | 20 | 29
387-
p4 | 1 | 30 | 39
381+
a | b | min | max
382+
------------+---+-----+-----
383+
mlparted11 | 1 | 2 | 4
384+
mlparted12 | 1 | 5 | 9
385+
mlparted2 | 1 | 10 | 19
386+
mlparted3 | 1 | 20 | 29
387+
mlparted4 | 1 | 30 | 39
388388
(5 rows)
389389

390390
-- check that message shown after failure to find a partition shows the
@@ -413,5 +413,3 @@ revoke all on key_desc from someone_else;
413413
revoke all on key_desc_1 from someone_else;
414414
drop role someone_else;
415415
drop table key_desc, key_desc_1;
416-
-- cleanup
417-
drop table p;

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ VACUUM;
99
\a\t
1010
SELECT relname, relhasindex
1111
FROM pg_class c LEFT JOIN pg_namespace n ON n.oid = relnamespace
12-
WHERE relkind='r' AND (nspname ~ '^pg_temp_') IS NOT TRUE
12+
WHERE relkindIN ('r', 'P') AND (nspname ~ '^pg_temp_') IS NOT TRUE
1313
ORDER BY relname;
1414
a|f
1515
a_star|f
@@ -70,6 +70,13 @@ line_tbl|f
7070
log_table|f
7171
lseg_tbl|f
7272
main_table|f
73+
mlparted|f
74+
mlparted1|f
75+
mlparted11|f
76+
mlparted12|f
77+
mlparted2|f
78+
mlparted3|f
79+
mlparted4|f
7380
money_data|f
7481
num_data|f
7582
num_exp_add|t

‎src/test/regress/sql/alter_table.sql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2227,3 +2227,4 @@ alter table p attach partition p1 for values from (1, 2) to (1, 10);
22272227

22282228
-- cleanup
22292229
droptable p;
2230+
droptable p1;

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

Lines changed: 33 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -189,55 +189,55 @@ select tableoid::regclass::text, a, min(b) as min_b, max(b) as max_b from list_p
189189
droptable range_parted, list_parted;
190190

191191
-- more tests for certain multi-level partitioning scenarios
192-
createtablep (aint, bint) partition by range (a, b);
193-
createtablep1 (bintnot null, aintnot null) partition by range ((b+0));
194-
createtablep11 (likep1);
195-
altertablep11 drop a;
196-
altertablep11 add aint;
197-
altertablep11 drop a;
198-
altertablep11 add aintnot null;
199-
-- attnum for key attribute 'a' is different inp, p1, andp11
192+
createtablemlparted (aint, bint) partition by range (a, b);
193+
createtablemlparted1 (bintnot null, aintnot null) partition by range ((b+0));
194+
createtablemlparted11 (likemlparted1);
195+
altertablemlparted11 drop a;
196+
altertablemlparted11 add aint;
197+
altertablemlparted11 drop a;
198+
altertablemlparted11 add aintnot null;
199+
-- attnum for key attribute 'a' is different inmlparted, mlparted1, andmlparted11
200200
select attrelid::regclass, attname, attnum
201201
from pg_attribute
202202
where attname='a'
203-
and (attrelid='p'::regclass
204-
or attrelid='p1'::regclass
205-
or attrelid='p11'::regclass)
203+
and (attrelid='mlparted'::regclass
204+
or attrelid='mlparted1'::regclass
205+
or attrelid='mlparted11'::regclass)
206206
order by attrelid::regclass::text;
207207

208-
altertablep1 attach partitionp11 forvaluesfrom (2) to (5);
209-
altertablep attach partitionp1 forvaluesfrom (1,2) to (1,10);
208+
altertablemlparted1 attach partitionmlparted11 forvaluesfrom (2) to (5);
209+
altertablemlparted attach partitionmlparted1 forvaluesfrom (1,2) to (1,10);
210210

211-
-- check that "(1, 2)" is correctly routed top11.
212-
insert intopvalues (1,2);
213-
select tableoid::regclass,*fromp;
211+
-- check that "(1, 2)" is correctly routed tomlparted11.
212+
insert intomlpartedvalues (1,2);
213+
select tableoid::regclass,*frommlparted;
214214

215-
-- check that proper message is shown after failure to route throughp1
216-
insert intop (a, b)values (1,5);
215+
-- check that proper message is shown after failure to route throughmlparted1
216+
insert intomlparted (a, b)values (1,5);
217217

218-
truncatep;
219-
altertablep addconstraint check_bcheck (b=3);
220-
-- check that correct input row is shown when constraint check_b fails onp11
218+
truncatemlparted;
219+
altertablemlparted addconstraint check_bcheck (b=3);
220+
-- check that correct input row is shown when constraint check_b fails onmlparted11
221221
-- after "(1, 2)" is routed to it
222-
insert intopvalues (1,2);
222+
insert intomlpartedvalues (1,2);
223223

224224
-- check that inserting into an internal partition successfully results in
225225
-- checking its partition constraint before inserting into the leaf partition
226226
-- selected by tuple-routing
227-
insert intop1 (a, b)values (2,3);
227+
insert intomlparted1 (a, b)values (2,3);
228228

229229
-- check that RETURNING works correctly with tuple-routing
230-
altertablep dropconstraint check_b;
231-
createtablep12 partition ofp1 forvaluesfrom (5) to (10);
232-
createtablep2 (bintnot null, aintnot null);
233-
altertablep attach partitionp2 forvaluesfrom (1,10) to (1,20);
234-
createtablep3 partition ofp forvaluesfrom (1,20) to (1,30);
235-
createtablep4 (likep);
236-
altertablep4 drop a;
237-
altertablep4 add aintnot null;
238-
altertablep attach partitionp4 forvaluesfrom (1,30) to (1,40);
230+
altertablemlparted dropconstraint check_b;
231+
createtablemlparted12 partition ofmlparted1 forvaluesfrom (5) to (10);
232+
createtablemlparted2 (bintnot null, aintnot null);
233+
altertablemlparted attach partitionmlparted2 forvaluesfrom (1,10) to (1,20);
234+
createtablemlparted3 partition ofmlparted forvaluesfrom (1,20) to (1,30);
235+
createtablemlparted4 (likemlparted);
236+
altertablemlparted4 drop a;
237+
altertablemlparted4 add aintnot null;
238+
altertablemlparted attach partitionmlparted4 forvaluesfrom (1,30) to (1,40);
239239
with ins (a, b, c)as
240-
(insert intop (b, a)selects.a,1from generate_series(2,39) s(a) returning tableoid::regclass,*)
240+
(insert intomlparted (b, a)selects.a,1from generate_series(2,39) s(a) returning tableoid::regclass,*)
241241
select a, b,min(c),max(c)from insgroup by a, border by1;
242242

243243
-- check that message shown after failure to find a partition shows the
@@ -266,6 +266,3 @@ revoke all on key_desc from someone_else;
266266
revoke allon key_desc_1from someone_else;
267267
drop role someone_else;
268268
droptable key_desc, key_desc_1;
269-
270-
-- cleanup
271-
droptable p;

‎src/test/regress/sql/sanity_check.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ VACUUM;
1212

1313
SELECT relname, relhasindex
1414
FROM pg_class cLEFT JOIN pg_namespace nONn.oid= relnamespace
15-
WHERE relkind='r'AND (nspname ~'^pg_temp_') IS NOT TRUE
15+
WHERE relkindIN ('r','P')AND (nspname ~'^pg_temp_') IS NOT TRUE
1616
ORDER BY relname;
1717

1818
-- restore normal output mode

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp