commit 48cc023e889e02f8f172c5130a6f958c92da3ddf Author: Lukas Fittl Date: Sat Feb 20 04:38:04 2021 -0800 Avoid zero-length delimiter in regression test files This is a pg_query-specific patch that ensures we can use the split function on the regression test files. Zero-length delimiters fail at the scanner level in Postgres, and thus need to be removed. diff --git a/src/test/regress/expected/copy2.out b/src/test/regress/expected/copy2.out index 61a19cdc4c..dea5308f64 100644 --- a/src/test/regress/expected/copy2.out +++ b/src/test/regress/expected/copy2.out @@ -510,9 +510,9 @@ BEGIN; COPY forcetest (a, b, c) FROM STDIN WITH (FORMAT csv, FORCE_NOT_NULL(b), FORCE_NULL(c)); COMMIT; SELECT b, c FROM forcetest WHERE a = 1; - b | c ----+------ - | NULL + b | c +---+---------- + | notempty (1 row) -- should succeed, FORCE_NULL and FORCE_NOT_NULL can be both specified @@ -520,17 +520,17 @@ BEGIN; COPY forcetest (a, b, c, d) FROM STDIN WITH (FORMAT csv, FORCE_NOT_NULL(c,d), FORCE_NULL(c,d)); COMMIT; SELECT c, d FROM forcetest WHERE a = 2; - c | d ----+------ - | NULL + c | d +---+---------- + | notempty (1 row) -- should fail with not-null constraint violation BEGIN; COPY forcetest (a, b, c) FROM STDIN WITH (FORMAT csv, FORCE_NULL(b), FORCE_NOT_NULL(c)); ERROR: null value in column "b" of relation "forcetest" violates not-null constraint -DETAIL: Failing row contains (3, null, , null, null). -CONTEXT: COPY forcetest, line 1: "3,,""" +DETAIL: Failing row contains (3, null, notempty, null, null). +CONTEXT: COPY forcetest, line 1: "3,,"notempty"" ROLLBACK; -- should fail with "not referenced by COPY" error BEGIN; diff --git a/src/test/regress/expected/create_am.out b/src/test/regress/expected/create_am.out index 35d4cf1d46..4a24834dab 100644 --- a/src/test/regress/expected/create_am.out +++ b/src/test/regress/expected/create_am.out @@ -537,10 +537,8 @@ ORDER BY 3, 1, 2; ROLLBACK; -- Third, check that we can neither create a table using a nonexistent -- AM, nor using an index AM -CREATE TABLE i_am_a_failure() USING ""; -ERROR: zero-length delimited identifier at or near """" -LINE 1: CREATE TABLE i_am_a_failure() USING ""; - ^ +CREATE TABLE i_am_a_failure() USING "notempty"; +ERROR: access method "notempty" does not exist CREATE TABLE i_am_a_failure() USING i_do_not_exist_am; ERROR: access method "i_do_not_exist_am" does not exist CREATE TABLE i_am_a_failure() USING "I do not exist AM"; diff --git a/src/test/regress/sql/copy2.sql b/src/test/regress/sql/copy2.sql index 8b14962194..9a5eaf3a6d 100644 --- a/src/test/regress/sql/copy2.sql +++ b/src/test/regress/sql/copy2.sql @@ -325,21 +325,21 @@ CREATE TEMP TABLE forcetest ( -- 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)); -1,,"" +1,,"notempty" \. COMMIT; SELECT b, c FROM forcetest WHERE a = 1; -- should succeed, FORCE_NULL and FORCE_NOT_NULL can be both specified BEGIN; COPY forcetest (a, b, c, d) FROM STDIN WITH (FORMAT csv, FORCE_NOT_NULL(c,d), FORCE_NULL(c,d)); -2,'a',,"" +2,'a',,"notempty" \. COMMIT; SELECT c, d FROM forcetest WHERE a = 2; -- should fail with not-null constraint violation BEGIN; COPY forcetest (a, b, c) FROM STDIN WITH (FORMAT csv, FORCE_NULL(b), FORCE_NOT_NULL(c)); -3,,"" +3,,"notempty" \. ROLLBACK; -- should fail with "not referenced by COPY" error @@ -353,21 +353,21 @@ ROLLBACK; -- 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 *, FORCE_NULL *); -4,,"" +4,,"notempty" \. COMMIT; SELECT b, c FROM forcetest WHERE a = 4; -- should succeed with effect ("b" remains an empty string) BEGIN; COPY forcetest (a, b, c) FROM STDIN WITH (FORMAT csv, FORCE_NOT_NULL *); -5,,"" +5,,"notempty" \. COMMIT; SELECT b, c FROM forcetest WHERE a = 5; -- should succeed with effect ("c" remains NULL) BEGIN; COPY forcetest (a, b, c) FROM STDIN WITH (FORMAT csv, FORCE_NULL *); -6,"b","" +6,"b","notempty" \. COMMIT; SELECT b, c FROM forcetest WHERE a = 6; diff --git a/src/test/regress/sql/create_am.sql b/src/test/regress/sql/create_am.sql index 825aed325e..f305bf68ce 100644 --- a/src/test/regress/sql/create_am.sql +++ b/src/test/regress/sql/create_am.sql @@ -343,7 +343,7 @@ ROLLBACK; -- Third, check that we can neither create a table using a nonexistent -- AM, nor using an index AM -CREATE TABLE i_am_a_failure() USING ""; +CREATE TABLE i_am_a_failure() USING "notempty"; CREATE TABLE i_am_a_failure() USING i_do_not_exist_am; CREATE TABLE i_am_a_failure() USING "I do not exist AM"; CREATE TABLE i_am_a_failure() USING "btree";