diff options
| author | Bruce Momjian | 2013-01-26 18:33:24 +0000 |
|---|---|---|
| committer | Bruce Momjian | 2013-01-26 18:33:24 +0000 |
| commit | 4deb57de7dcfb66f850f16c0324731fdf3d86d09 (patch) | |
| tree | e72418260ea7649af2da9c9f5e59a2890dca0d79 /src/test | |
| parent | 7e2322dff30c04d90c0602d2b5ae24b4881db88b (diff) | |
Issue ERROR if FREEZE mode can't be honored by COPY
Previously non-honored FREEZE mode was ignored. This also issues an
appropriate error message based on the cause of the failure, per
suggestion from Tom. Additional regression test case added.
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/regress/expected/copy2.out | 18 | ||||
| -rw-r--r-- | src/test/regress/sql/copy2.sql | 9 |
2 files changed, 16 insertions, 11 deletions
diff --git a/src/test/regress/expected/copy2.out b/src/test/regress/expected/copy2.out index 78c601fd9b..5777b24274 100644 --- a/src/test/regress/expected/copy2.out +++ b/src/test/regress/expected/copy2.out @@ -334,22 +334,20 @@ SELECT * FROM vistest; COMMIT; TRUNCATE vistest; COPY vistest FROM stdin CSV FREEZE; +ERROR: cannot perform FREEZE because the table was not created or truncated in the current transaction +BEGIN; +TRUNCATE vistest; +SAVEPOINT s1; +COPY vistest FROM stdin CSV FREEZE; +ERROR: cannot perform FREEZE because of transaction activity after table creation or truncation +COMMIT; BEGIN; INSERT INTO vistest VALUES ('z'); SAVEPOINT s1; TRUNCATE vistest; ROLLBACK TO SAVEPOINT s1; COPY vistest FROM stdin CSV FREEZE; -SELECT * FROM vistest; - a ----- - p - g - z - d3 - e -(5 rows) - +ERROR: cannot perform FREEZE because the table was not created or truncated in the current transaction COMMIT; CREATE FUNCTION truncate_in_subxact() RETURNS VOID AS $$ diff --git a/src/test/regress/sql/copy2.sql b/src/test/regress/sql/copy2.sql index 55568e68e4..c46128b38a 100644 --- a/src/test/regress/sql/copy2.sql +++ b/src/test/regress/sql/copy2.sql @@ -234,6 +234,14 @@ p g \. BEGIN; +TRUNCATE vistest; +SAVEPOINT s1; +COPY vistest FROM stdin CSV FREEZE; +m +k +\. +COMMIT; +BEGIN; INSERT INTO vistest VALUES ('z'); SAVEPOINT s1; TRUNCATE vistest; @@ -242,7 +250,6 @@ COPY vistest FROM stdin CSV FREEZE; d3 e \. -SELECT * FROM vistest; COMMIT; CREATE FUNCTION truncate_in_subxact() RETURNS VOID AS $$ |
