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

Commitafe9b9e

Browse files
committed
Add regression test for ATTACH PARTITION
This test case uses a SQL function as partitioning operator, whoseevaluation results in the table's relcache being rebuilt partwaythrough the execution of an ATTACH PARTITION command.It is extracted from39808e8, which fixed a bug where this test casefailed on master and REL_11_STABLE, but passed on REL_10_STABLE. Thepartitioning code has changed a lot during v11 development, so thismakes sure that any patch applied to REL_10_STABLE fixing apartition-related bug does not break it again.Author: Amit LangoteReviewed-by: Michaël Paquier, Álvaro HerreraDiscussion:https://postgr.es/m/CAKcux6=nTz9KSfTr_6Z2mpzLJ_09JN-rK6=dWic6gGyTSWueyQ@mail.gmail.com
1 parent101b21e commitafe9b9e

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3669,3 +3669,18 @@ alter table temp_part_parent attach partition temp_part_child
36693669
for values in (1, 2); -- ok
36703670
drop table perm_part_parent cascade;
36713671
drop table temp_part_parent cascade;
3672+
-- test case where the partitioning operator is a SQL function whose
3673+
-- evaluation results in the table's relcache being rebuilt partway through
3674+
-- the execution of an ATTACH PARTITION command
3675+
create function at_test_sql_partop (int4, int4) returns int language sql
3676+
as $$ select case when $1 = $2 then 0 when $1 > $2 then 1 else -1 end; $$;
3677+
create operator class at_test_sql_partop for type int4 using btree as
3678+
operator 1 < (int4, int4), operator 2 <= (int4, int4),
3679+
operator 3 = (int4, int4), operator 4 >= (int4, int4),
3680+
operator 5 > (int4, int4), function 1 at_test_sql_partop(int4, int4);
3681+
create table at_test_sql_partop (a int) partition by range (a at_test_sql_partop);
3682+
create table at_test_sql_partop_1 (a int);
3683+
alter table at_test_sql_partop attach partition at_test_sql_partop_1 for values from (0) to (10);
3684+
drop table at_test_sql_partop;
3685+
drop operator class at_test_sql_partop using btree;
3686+
drop function at_test_sql_partop;

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

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2388,3 +2388,19 @@ alter table temp_part_parent attach partition temp_part_child
23882388
forvaluesin (1,2);-- ok
23892389
droptable perm_part_parent cascade;
23902390
droptable temp_part_parent cascade;
2391+
2392+
-- test case where the partitioning operator is a SQL function whose
2393+
-- evaluation results in the table's relcache being rebuilt partway through
2394+
-- the execution of an ATTACH PARTITION command
2395+
createfunctionat_test_sql_partop (int4, int4) returnsint language sql
2396+
as $$select case when $1= $2 then0 when $1> $2 then1 else-1 end; $$;
2397+
createoperator classat_test_sql_partop for type int4 using btreeas
2398+
operator1< (int4, int4), operator2<= (int4, int4),
2399+
operator3= (int4, int4), operator4>= (int4, int4),
2400+
operator5> (int4, int4), function1 at_test_sql_partop(int4, int4);
2401+
createtableat_test_sql_partop (aint) partition by range (a at_test_sql_partop);
2402+
createtableat_test_sql_partop_1 (aint);
2403+
altertable at_test_sql_partop attach partition at_test_sql_partop_1 forvaluesfrom (0) to (10);
2404+
droptable at_test_sql_partop;
2405+
dropoperator class at_test_sql_partop using btree;
2406+
dropfunction at_test_sql_partop;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp