@@ -22,6 +22,7 @@ ERROR: syntax error at or near "' - third line'"
22
22
LINE 3: ' - third line'
23
23
^
24
24
-- Unicode escapes
25
+ SET standard_conforming_strings TO on;
25
26
SELECT U&'d\0061t\+000061' AS U&"d\0061t\+000061";
26
27
data
27
28
------
@@ -34,6 +35,18 @@ SELECT U&'d!0061t\+000061' UESCAPE '!' AS U&"d*0061t\+000061" UESCAPE '*';
34
35
dat\+000061
35
36
(1 row)
36
37
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
+
37
50
SELECT U&'wrong: \061';
38
51
ERROR: invalid Unicode escape value at or near "\061'"
39
52
LINE 1: SELECT U&'wrong: \061';
@@ -46,6 +59,32 @@ SELECT U&'wrong: +0061' UESCAPE '+';
46
59
ERROR: invalid Unicode escape character at or near "+'"
47
60
LINE 1: SELECT U&'wrong: +0061' UESCAPE '+';
48
61
^
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;
49
88
--
50
89
-- test conversions between various string types
51
90
-- E021-10 implicit casting among the character data types
0 commit comments