diff options
author | Alvaro Herrera <alvherre@alvh.no-ip.org> | 2018-11-19 11:16:28 -0300 |
---|---|---|
committer | Alvaro Herrera <alvherre@alvh.no-ip.org> | 2018-11-19 11:16:28 -0300 |
commit | 5c9a5513a3967367e5fcc9237bc4146f4b24b408 (patch) | |
tree | d8acc5202d30e1307d009f3b9537cc5ab77ab2ca /src/test | |
parent | fc47e99a157a56a92dea679a74d546e28b253bb7 (diff) | |
download | postgresql-5c9a5513a3967367e5fcc9237bc4146f4b24b408.tar.gz postgresql-5c9a5513a3967367e5fcc9237bc4146f4b24b408.zip |
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
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/regress/input/copy.source | 6 | ||||
-rw-r--r-- | src/test/regress/output/copy.source | 6 |
2 files changed, 12 insertions, 0 deletions
diff --git a/src/test/regress/input/copy.source b/src/test/regress/input/copy.source index 4cb03c566fa..aefc99167af 100644 --- a/src/test/regress/input/copy.source +++ b/src/test/regress/input/copy.source @@ -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; diff --git a/src/test/regress/output/copy.source b/src/test/regress/output/copy.source index ddd652c7128..b16247230a0 100644 --- a/src/test/regress/output/copy.source +++ b/src/test/regress/output/copy.source @@ -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 |