diff options
author | Bruce Momjian | 2006-03-06 19:49:20 +0000 |
---|---|---|
committer | Bruce Momjian | 2006-03-06 19:49:20 +0000 |
commit | 19c21d115d221d9738afad142f2886dfd3cc40de (patch) | |
tree | f5a4a3f11ae8a6efe639a8717f5fa2c267dbd7b0 /src/test | |
parent | a9c1047ebdde533949fd8096c8ac1eca5e821292 (diff) |
Enable standard_conforming_strings to be turned on.
Kevin Grittner
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/regress/expected/strings.out | 87 | ||||
-rw-r--r-- | src/test/regress/sql/strings.sql | 34 |
2 files changed, 117 insertions, 4 deletions
diff --git a/src/test/regress/expected/strings.out b/src/test/regress/expected/strings.out index d05ce562997..6faf3c69ad5 100644 --- a/src/test/regress/expected/strings.out +++ b/src/test/regress/expected/strings.out @@ -193,13 +193,13 @@ SELECT SUBSTRING('abcdefg' FROM 'b(.*)f') AS "cde"; (1 row) -- PostgreSQL extension to allow using back reference in replace string; -SELECT regexp_replace('1112223333', '(\\d{3})(\\d{3})(\\d{4})', '(\\1) \\2-\\3'); +SELECT regexp_replace('1112223333', E'(\\d{3})(\\d{3})(\\d{4})', E'(\\1) \\2-\\3'); regexp_replace ---------------- (111) 222-3333 (1 row) -SELECT regexp_replace('AAA BBB CCC ', '\\s+', ' ', 'g'); +SELECT regexp_replace('AAA BBB CCC ', E'\\s+', ' ', 'g'); regexp_replace ---------------- AAA BBB CCC @@ -895,3 +895,86 @@ select md5('12345678901234567890123456789012345678901234567890123456789012345678 t (1 row) +-- +-- test behavior of escape_string_warning and standard_conforming_strings options +-- +set escape_string_warning = off; +set standard_conforming_strings = off; +show escape_string_warning; + escape_string_warning +----------------------- + off +(1 row) + +show standard_conforming_strings; + standard_conforming_strings +----------------------------- + off +(1 row) + +set escape_string_warning = on; +set standard_conforming_strings = on; +show escape_string_warning; + escape_string_warning +----------------------- + on +(1 row) + +show standard_conforming_strings; + standard_conforming_strings +----------------------------- + on +(1 row) + +select 'a\bcd' as f1, 'a\b''cd' as f2, 'a\b''''cd' as f3, 'abcd\' as f4, 'ab\''cd' as f5, '\\' as f6; +WARNING: nonstandard use of escape in a string literal at character 8 +HINT: Use the escape string syntax for escapes, e.g., E'\r\n'. +WARNING: nonstandard use of escape in a string literal at character 23 +HINT: Use the escape string syntax for escapes, e.g., E'\r\n'. +WARNING: nonstandard use of escape in a string literal at character 40 +HINT: Use the escape string syntax for escapes, e.g., E'\r\n'. +WARNING: nonstandard use of escape in a string literal at character 59 +HINT: Use the escape string syntax for escapes, e.g., E'\r\n'. +WARNING: nonstandard use of escape in a string literal at character 76 +HINT: Use the escape string syntax for escapes, e.g., E'\r\n'. +WARNING: nonstandard use of escape in a string literal at character 93 +HINT: Use the escape string syntax for escapes, e.g., E'\r\n'. + f1 | f2 | f3 | f4 | f5 | f6 +-------+--------+---------+-------+--------+---- + a\bcd | a\b'cd | a\b''cd | abcd\ | ab\'cd | \\ +(1 row) + +set standard_conforming_strings = off; +select 'a\\bcd' as f1, 'a\\b\'cd' as f2, 'a\\b\'''cd' as f3, 'abcd\\' as f4, 'ab\\\'cd' as f5, '\\\\' as f6; +WARNING: nonstandard use of \\ in a string literal at character 8 +HINT: Use the escape string syntax for backslashes, e.g., E'\\'. +WARNING: nonstandard use of \\ in a string literal at character 24 +HINT: Use the escape string syntax for backslashes, e.g., E'\\'. +WARNING: nonstandard use of \\ in a string literal at character 42 +HINT: Use the escape string syntax for backslashes, e.g., E'\\'. +WARNING: nonstandard use of \\ in a string literal at character 62 +HINT: Use the escape string syntax for backslashes, e.g., E'\\'. +WARNING: nonstandard use of \\ in a string literal at character 80 +HINT: Use the escape string syntax for backslashes, e.g., E'\\'. +WARNING: nonstandard use of \\ in a string literal at character 98 +HINT: Use the escape string syntax for backslashes, e.g., E'\\'. + f1 | f2 | f3 | f4 | f5 | f6 +-------+--------+---------+-------+--------+---- + a\bcd | a\b'cd | a\b''cd | abcd\ | ab\'cd | \\ +(1 row) + +set escape_string_warning = off; +set standard_conforming_strings = on; +select 'a\bcd' as f1, 'a\b''cd' as f2, 'a\b''''cd' as f3, 'abcd\' as f4, 'ab\''cd' as f5, '\\' as f6; + f1 | f2 | f3 | f4 | f5 | f6 +-------+--------+---------+-------+--------+---- + a\bcd | a\b'cd | a\b''cd | abcd\ | ab\'cd | \\ +(1 row) + +set standard_conforming_strings = off; +select 'a\\bcd' as f1, 'a\\b\'cd' as f2, 'a\\b\'''cd' as f3, 'abcd\\' as f4, 'ab\\\'cd' as f5, '\\\\' as f6; + f1 | f2 | f3 | f4 | f5 | f6 +-------+--------+---------+-------+--------+---- + a\bcd | a\b'cd | a\b''cd | abcd\ | ab\'cd | \\ +(1 row) + diff --git a/src/test/regress/sql/strings.sql b/src/test/regress/sql/strings.sql index 620aabe8ae6..570d9a27f46 100644 --- a/src/test/regress/sql/strings.sql +++ b/src/test/regress/sql/strings.sql @@ -81,8 +81,8 @@ SELECT SUBSTRING('abcdefg' FROM 'c.e') AS "cde"; SELECT SUBSTRING('abcdefg' FROM 'b(.*)f') AS "cde"; -- PostgreSQL extension to allow using back reference in replace string; -SELECT regexp_replace('1112223333', '(\\d{3})(\\d{3})(\\d{4})', '(\\1) \\2-\\3'); -SELECT regexp_replace('AAA BBB CCC ', '\\s+', ' ', 'g'); +SELECT regexp_replace('1112223333', E'(\\d{3})(\\d{3})(\\d{4})', E'(\\1) \\2-\\3'); +SELECT regexp_replace('AAA BBB CCC ', E'\\s+', ' ', 'g'); SELECT regexp_replace('AAA', '^|$', 'Z', 'g'); SELECT regexp_replace('AAA aaa', 'A+', 'Z', 'gi'); -- invalid option of REGEXP_REPLACE @@ -352,3 +352,33 @@ select md5('abcdefghijklmnopqrstuvwxyz'::bytea) = 'c3fcd3d76192e4007dfb496cca67e select md5('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'::bytea) = 'd174ab98d277d9f5a5611c2c9f419d9f' AS "TRUE"; select md5('12345678901234567890123456789012345678901234567890123456789012345678901234567890'::bytea) = '57edf4a22be3c955ac49da2e2107b67a' AS "TRUE"; + +-- +-- test behavior of escape_string_warning and standard_conforming_strings options +-- +set escape_string_warning = off; +set standard_conforming_strings = off; + +show escape_string_warning; +show standard_conforming_strings; + +set escape_string_warning = on; +set standard_conforming_strings = on; + +show escape_string_warning; +show standard_conforming_strings; + +select 'a\bcd' as f1, 'a\b''cd' as f2, 'a\b''''cd' as f3, 'abcd\' as f4, 'ab\''cd' as f5, '\\' as f6; + +set standard_conforming_strings = off; + +select 'a\\bcd' as f1, 'a\\b\'cd' as f2, 'a\\b\'''cd' as f3, 'abcd\\' as f4, 'ab\\\'cd' as f5, '\\\\' as f6; + +set escape_string_warning = off; +set standard_conforming_strings = on; + +select 'a\bcd' as f1, 'a\b''cd' as f2, 'a\b''''cd' as f3, 'abcd\' as f4, 'ab\''cd' as f5, '\\' as f6; + +set standard_conforming_strings = off; + +select 'a\\bcd' as f1, 'a\\b\'cd' as f2, 'a\\b\'''cd' as f3, 'abcd\\' as f4, 'ab\\\'cd' as f5, '\\\\' as f6; |