Index: src/test/regress/expected/strings.out =================================================================== RCS file: /projects/cvsroot/pgsql/src/test/regress/expected/strings.out,v retrieving revision 1.26 diff -c -r1.26 strings.out *** src/test/regress/expected/strings.out 10 Jul 2005 04:54:33 -0000 1.26 --- src/test/regress/expected/strings.out 26 Jan 2006 17:36:29 -0000 *************** *** 193,205 **** (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'); regexp_replace ---------------- (111) 222-3333 (1 row) ! SELECT regexp_replace('AAA BBB CCC ', '\\s+', ' ', 'g'); regexp_replace ---------------- AAA BBB CCC --- 193,205 ---- (1 row) -- PostgreSQL extension to allow using back reference in replace string; ! 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 ', E'\\s+', ' ', 'g'); regexp_replace ---------------- AAA BBB CCC *************** *** 895,897 **** --- 895,982 ---- 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; + invalid command \ + set escape_string_warning = off; + 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 escapes, e.g., E'\r\n'. + WARNING: nonstandard use of \\ in a string literal at character 62 + HINT: Use the escape string syntax for escapes, e.g., E'\r\n'. + WARNING: nonstandard use of \\ in a string literal at character 80 + HINT: Use the escape string syntax for escapes, e.g., E'\r\n'. + WARNING: nonstandard use of \\ in a string literal at character 98 + 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 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) + Index: src/test/regress/sql/strings.sql =================================================================== RCS file: /projects/cvsroot/pgsql/src/test/regress/sql/strings.sql,v retrieving revision 1.17 diff -c -r1.17 strings.sql *** src/test/regress/sql/strings.sql 10 Jul 2005 04:54:33 -0000 1.17 --- src/test/regress/sql/strings.sql 26 Jan 2006 17:36:29 -0000 *************** *** 81,88 **** 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('AAA', '^|$', 'Z', 'g'); SELECT regexp_replace('AAA aaa', 'A+', 'Z', 'gi'); -- invalid option of REGEXP_REPLACE --- 81,88 ---- SELECT SUBSTRING('abcdefg' FROM 'b(.*)f') AS "cde"; -- PostgreSQL extension to allow using back reference in replace string; ! 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,354 **** --- 352,384 ---- 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;