From f607e8b6d72d89c45a9123966eecf5ed00a7b0b3 Mon Sep 17 00:00:00 2001 From: Hanefi Onaldi Date: Mon, 5 Aug 2024 21:19:58 +0300 Subject: [PATCH] Reproduce failures when filtering partitions PostgreSQL command `TRUNCATE ONLY` does not support partitioned tables. This commit adds a test case to ensure that the `TRUNCATE ONLY` command is not used on partitioned tables. ERROR: cannot truncate only a partitioned table HINT: Do not specify the ONLY keyword, or use TRUNCATE ONLY on the partitions directly. ERROR: cannot truncate only a partitioned table SQL query: TRUNCATE ONLY partitioned_tables.sellers --- tests/filtering/exclude.ini | 1 + tests/filtering/extra.sql | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/tests/filtering/exclude.ini b/tests/filtering/exclude.ini index 544c3b67f..8a8322f41 100644 --- a/tests/filtering/exclude.ini +++ b/tests/filtering/exclude.ini @@ -17,3 +17,4 @@ foo.matview_1_exclude_as_table [exclude-table-data] foo.matview_1_exclude_data +partitioned_tables.sellers_archive diff --git a/tests/filtering/extra.sql b/tests/filtering/extra.sql index a9d0ce632..bb2f83f84 100644 --- a/tests/filtering/extra.sql +++ b/tests/filtering/extra.sql @@ -107,3 +107,15 @@ select setval('seq.standalone_smallint_id_seq', 670); -- A standalone sequence with a minvalue that has not been set create sequence seq.standalone_minvalue_id_seq minvalue 671; + +create schema partitioned_tables; + +create table partitioned_tables.sellers ( + id bigint, + archive smallint not null +) partition by list (archive); + +create table partitioned_tables.sellers_active partition of partitioned_tables.sellers default; +create table partitioned_tables.sellers_archive partition of partitioned_tables.sellers for values in ('1'); + +insert into partitioned_tables.sellers (id, archive) values (1, 0), (2, 1), (3, 0);