@@ -22,6 +22,7 @@ ERROR:  syntax error at or near "' - third line'"
2222LINE 3: ' - third line'
2323        ^
2424-- Unicode escapes
25+ SET standard_conforming_strings TO on;
2526SELECT U&'d\0061t\+000061' AS U&"d\0061t\+000061";
2627 data 
2728------
@@ -34,6 +35,18 @@ SELECT U&'d!0061t\+000061' UESCAPE '!' AS U&"d*0061t\+000061" UESCAPE '*';
3435 dat\+000061
3536(1 row)
3637
38+ SELECT U&' \' UESCAPE '!' AS "tricky";
39+  tricky 
40+ --------
41+   \
42+ (1 row)
43+ 
44+ SELECT 'tricky' AS U&"\" UESCAPE '!';
45+    \    
46+ --------
47+  tricky
48+ (1 row)
49+ 
3750SELECT U&'wrong: \061';
3851ERROR:  invalid Unicode escape value at or near "\061'"
3952LINE 1: SELECT U&'wrong: \061';
@@ -46,6 +59,32 @@ SELECT U&'wrong: +0061' UESCAPE '+';
4659ERROR:  invalid Unicode escape character at or near "+'"
4760LINE 1: SELECT U&'wrong: +0061' UESCAPE '+';
4861                                         ^
62+ SET standard_conforming_strings TO off;
63+ SELECT U&'d\0061t\+000061' AS U&"d\0061t\+000061";
64+ ERROR:  unsafe use of string constant with Unicode escapes
65+ DETAIL:  String constants with Unicode escapes cannot be used when standard_conforming_strings is off.
66+ SELECT U&'d!0061t\+000061' UESCAPE '!' AS U&"d*0061t\+000061" UESCAPE '*';
67+ ERROR:  unsafe use of string constant with Unicode escapes
68+ DETAIL:  String constants with Unicode escapes cannot be used when standard_conforming_strings is off.
69+ SELECT U&' \' UESCAPE '!' AS "tricky";
70+ ERROR:  unsafe use of string constant with Unicode escapes
71+ DETAIL:  String constants with Unicode escapes cannot be used when standard_conforming_strings is off.
72+ SELECT 'tricky' AS U&"\" UESCAPE '!';
73+    \    
74+ --------
75+  tricky
76+ (1 row)
77+ 
78+ SELECT U&'wrong: \061';
79+ ERROR:  unsafe use of string constant with Unicode escapes
80+ DETAIL:  String constants with Unicode escapes cannot be used when standard_conforming_strings is off.
81+ SELECT U&'wrong: \+0061';
82+ ERROR:  unsafe use of string constant with Unicode escapes
83+ DETAIL:  String constants with Unicode escapes cannot be used when standard_conforming_strings is off.
84+ SELECT U&'wrong: +0061' UESCAPE '+';
85+ ERROR:  unsafe use of string constant with Unicode escapes
86+ DETAIL:  String constants with Unicode escapes cannot be used when standard_conforming_strings is off.
87+ RESET standard_conforming_strings;
4988--
5089-- test conversions between various string types
5190-- E021-10 implicit casting among the character data types
0 commit comments