mirror of
https://github.com/postgres/postgres.git
synced 2025-07-28 23:42:10 +03:00
Disallow COPY FREEZE on partitioned tables
This didn't actually work: COPY would fail to flush the right files, and instead would try to flush a non-existing file, causing the whole transaction to fail. Cope by raising an error as soon as the command is sent instead, to avoid a nasty later surprise. Of course, it would be much better to make it work, but we don't have a patch for that yet, and we don't know if we'll want to backpatch one when we do. Reported-by: Tomas Vondra Author: David Rowley Reviewed-by: Amit Langote, Steve Singer, Tomas Vondra
This commit is contained in:
@ -159,6 +159,12 @@ truncate parted_copytest;
|
||||
|
||||
copy parted_copytest from '@abs_builddir@/results/parted_copytest.csv';
|
||||
|
||||
-- Ensure COPY FREEZE errors for partitioned tables.
|
||||
begin;
|
||||
truncate parted_copytest;
|
||||
copy parted_copytest from '@abs_builddir@/results/parted_copytest.csv' (freeze);
|
||||
rollback;
|
||||
|
||||
select tableoid::regclass,count(*),sum(a) from parted_copytest
|
||||
group by tableoid order by tableoid::regclass::name;
|
||||
|
||||
|
@ -113,6 +113,12 @@ insert into parted_copytest select x,1,'One' from generate_series(1011,1020) x;
|
||||
copy (select * from parted_copytest order by a) to '@abs_builddir@/results/parted_copytest.csv';
|
||||
truncate parted_copytest;
|
||||
copy parted_copytest from '@abs_builddir@/results/parted_copytest.csv';
|
||||
-- Ensure COPY FREEZE errors for partitioned tables.
|
||||
begin;
|
||||
truncate parted_copytest;
|
||||
copy parted_copytest from '@abs_builddir@/results/parted_copytest.csv' (freeze);
|
||||
ERROR: cannot perform FREEZE on a partitioned table
|
||||
rollback;
|
||||
select tableoid::regclass,count(*),sum(a) from parted_copytest
|
||||
group by tableoid order by tableoid::regclass::name;
|
||||
tableoid | count | sum
|
||||
|
Reference in New Issue
Block a user