summaryrefslogtreecommitdiff
path: root/src/test/regress/sql/plancache.sql
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/regress/sql/plancache.sql')
-rw-r--r--src/test/regress/sql/plancache.sql21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/test/regress/sql/plancache.sql b/src/test/regress/sql/plancache.sql
index bc2086166b9..cb2a5514872 100644
--- a/src/test/regress/sql/plancache.sql
+++ b/src/test/regress/sql/plancache.sql
@@ -156,3 +156,24 @@ end$$ language plpgsql;
select cachebug();
select cachebug();
+
+-- Check that addition or removal of any partition is correctly dealt with by
+-- default partition table when it is being used in prepared statement.
+create table list_parted (a int) partition by list(a);
+create table list_part_null partition of list_parted for values in (null);
+create table list_part_1 partition of list_parted for values in (1);
+create table list_part_def partition of list_parted default;
+prepare pstmt_def_insert (int) as insert into list_part_def values($1);
+-- should fail
+execute pstmt_def_insert(null);
+execute pstmt_def_insert(1);
+create table list_part_2 partition of list_parted for values in (2);
+execute pstmt_def_insert(2);
+alter table list_parted detach partition list_part_null;
+-- should be ok
+execute pstmt_def_insert(null);
+drop table list_part_1;
+-- should be ok
+execute pstmt_def_insert(1);
+drop table list_parted, list_part_null;
+deallocate pstmt_def_insert;