On Wed, Mar 5, 2014 at 7:44 AM, Andrew Dunstan <[email protected]> wrote:
> I have picked this up and committed the patch. Thanks to all.
Sorry for coming after the battle, but while looking at what has been
committed I noticed that copy2.sql is actually doing twice in a row
the same test:
COPY forcetest (a, b, c) FROM STDIN WITH (FORMAT csv,
FORCE_NOT_NULL(b), FORCE_NULL(c));
1,,""
\.
-- should succeed with no effect ("b" remains an empty string, "c" remains NULL)
COPY forcetest (a, b, c) FROM STDIN WITH (FORMAT csv,
FORCE_NOT_NULL(b), FORCE_NULL(c));
2,,""
\.
See? For both tests the quotes are placed on the same column, the 3rd.
I think that one of them should be like that, with the quotes on the
2nd column => 2,"",
The attached patch corrects that... and a misplaced comment.
Regards,
--
Michael
diff --git a/src/test/regress/expected/copy2.out
b/src/test/regress/expected/copy2.out
index 76dea28..e8fb3d1 100644
--- a/src/test/regress/expected/copy2.out
+++ b/src/test/regress/expected/copy2.out
@@ -383,7 +383,6 @@ SELECT * FROM vistest;
(2 rows)
-- Test FORCE_NOT_NULL and FORCE_NULL options
--- should succeed with "b" set to an empty string and "c" set to NULL
CREATE TEMP TABLE forcetest (
a INT NOT NULL,
b TEXT NOT NULL,
@@ -392,6 +391,7 @@ CREATE TEMP TABLE forcetest (
e TEXT
);
\pset null NULL
+-- should succeed with "b" set to an empty string and "c" set to NULL
BEGIN;
COPY forcetest (a, b, c) FROM STDIN WITH (FORMAT csv, FORCE_NOT_NULL(b),
FORCE_NULL(c));
COMMIT;
diff --git a/src/test/regress/sql/copy2.sql b/src/test/regress/sql/copy2.sql
index e2be21f..63332bd 100644
--- a/src/test/regress/sql/copy2.sql
+++ b/src/test/regress/sql/copy2.sql
@@ -271,7 +271,6 @@ SELECT * FROM vistest;
COMMIT;
SELECT * FROM vistest;
-- Test FORCE_NOT_NULL and FORCE_NULL options
--- should succeed with "b" set to an empty string and "c" set to NULL
CREATE TEMP TABLE forcetest (
a INT NOT NULL,
b TEXT NOT NULL,
@@ -280,6 +279,7 @@ CREATE TEMP TABLE forcetest (
e TEXT
);
\pset null NULL
+-- should succeed with "b" set to an empty string and "c" set to NULL
BEGIN;
COPY forcetest (a, b, c) FROM STDIN WITH (FORMAT csv, FORCE_NOT_NULL(b),
FORCE_NULL(c));
1,,""
@@ -289,7 +289,7 @@ SELECT b, c FROM forcetest WHERE a = 1;
-- should succeed with no effect ("b" remains an empty string, "c" remains
NULL)
BEGIN;
COPY forcetest (a, b, c) FROM STDIN WITH (FORMAT csv, FORCE_NOT_NULL(b),
FORCE_NULL(c));
-2,,""
+2,"",
\.
COMMIT;
SELECT b, c FROM forcetest WHERE a = 2;
--
Sent via pgsql-hackers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers