summaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorRobert Haas2017-02-16 13:37:37 +0000
committerRobert Haas2017-02-16 13:40:58 +0000
commit59407301a39f47e35098a1c211f154adcd2bdaf9 (patch)
tree8b893fbdc4bda30f50ae6ac571fa043bad2fc27b /src/test
parent93e6e40574bccf9c6f33c520a4189d3e98e2fd1f (diff)
Avoid crash in ALTER TABLE not_partitioned DETACH PARTITION.
Amit Langote, reviewed and slightly changed by me.
Diffstat (limited to 'src/test')
-rw-r--r--src/test/regress/expected/alter_table.out5
-rw-r--r--src/test/regress/sql/alter_table.sql5
2 files changed, 10 insertions, 0 deletions
diff --git a/src/test/regress/expected/alter_table.out b/src/test/regress/expected/alter_table.out
index b0e80a7788..e84af67fb2 100644
--- a/src/test/regress/expected/alter_table.out
+++ b/src/test/regress/expected/alter_table.out
@@ -3259,6 +3259,11 @@ DETAIL: "list_parted2" is already a child of "list_parted2".
--
-- DETACH PARTITION
--
+-- check that the table is partitioned at all
+CREATE TABLE regular_table (a int);
+ALTER TABLE regular_table DETACH PARTITION any_name;
+ERROR: "regular_table" is not partitioned
+DROP TABLE regular_table;
-- check that the partition being detached exists at all
ALTER TABLE list_parted2 DETACH PARTITION part_4;
ERROR: relation "part_4" does not exist
diff --git a/src/test/regress/sql/alter_table.sql b/src/test/regress/sql/alter_table.sql
index 7513769359..a403fd8cb4 100644
--- a/src/test/regress/sql/alter_table.sql
+++ b/src/test/regress/sql/alter_table.sql
@@ -2139,6 +2139,11 @@ ALTER TABLE list_parted2 ATTACH PARTITION list_parted2 FOR VALUES IN (0);
-- DETACH PARTITION
--
+-- check that the table is partitioned at all
+CREATE TABLE regular_table (a int);
+ALTER TABLE regular_table DETACH PARTITION any_name;
+DROP TABLE regular_table;
+
-- check that the partition being detached exists at all
ALTER TABLE list_parted2 DETACH PARTITION part_4;