Skip to content

Commit

Permalink
Reproduce failures when filtering partitions
Browse files Browse the repository at this point in the history
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
  • Loading branch information
hanefi committed Aug 5, 2024
1 parent db08b75 commit f607e8b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions tests/filtering/exclude.ini
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ foo.matview_1_exclude_as_table

[exclude-table-data]
foo.matview_1_exclude_data
partitioned_tables.sellers_archive
12 changes: 12 additions & 0 deletions tests/filtering/extra.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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);

0 comments on commit f607e8b

Please sign in to comment.