aboutsummaryrefslogtreecommitdiff
path: root/src/test/regress/expected/json.out
blob: 5ef65f7c972bae86440a08b31eb330220d359714 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
-- Strings.
SELECT '""'::json;				-- OK.
 json 
------
 ""
(1 row)

SELECT $$''$$::json;			-- ERROR, single quotes are not allowed
ERROR:  invalid input syntax for type json
LINE 1: SELECT $$''$$::json;
               ^
DETAIL:  line 1: Token "'" is invalid.
SELECT '"abc"'::json;			-- OK
 json  
-------
 "abc"
(1 row)

SELECT '"abc'::json;			-- ERROR, quotes not closed
ERROR:  invalid input syntax for type json
LINE 1: SELECT '"abc'::json;
               ^
DETAIL:  line 1: Token ""abc" is invalid.
SELECT '"abc
def"'::json;					-- ERROR, unescaped newline in string constant
ERROR:  invalid input syntax for type json
LINE 1: SELECT '"abc
               ^
DETAIL:  line 1: Character "
" must be escaped.
SELECT '"\n\"\\"'::json;		-- OK, legal escapes
   json   
----------
 "\n\"\\"
(1 row)

SELECT '"\v"'::json;			-- ERROR, not a valid JSON escape
ERROR:  invalid input syntax for type json
LINE 1: SELECT '"\v"'::json;
               ^
DETAIL:  line 1: Invalid escape "\v".
SELECT '"\u"'::json;			-- ERROR, incomplete escape
ERROR:  invalid input syntax for type json
LINE 1: SELECT '"\u"'::json;
               ^
DETAIL:  line 1: "\u" must be followed by four hexadecimal digits.
SELECT '"\u00"'::json;			-- ERROR, incomplete escape
ERROR:  invalid input syntax for type json
LINE 1: SELECT '"\u00"'::json;
               ^
DETAIL:  line 1: "\u" must be followed by four hexadecimal digits.
SELECT '"\u000g"'::json;		-- ERROR, g is not a hex digit
ERROR:  invalid input syntax for type json
LINE 1: SELECT '"\u000g"'::json;
               ^
DETAIL:  line 1: "\u" must be followed by four hexadecimal digits.
SELECT '"\u0000"'::json;		-- OK, legal escape
   json   
----------
 "\u0000"
(1 row)

SELECT '"\uaBcD"'::json;		-- OK, uppercase and lower case both OK
   json   
----------
 "\uaBcD"
(1 row)

-- Numbers.
SELECT '1'::json;				-- OK
 json 
------
 1
(1 row)

SELECT '0'::json;				-- OK
 json 
------
 0
(1 row)

SELECT '01'::json;				-- ERROR, not valid according to JSON spec
ERROR:  invalid input syntax for type json
LINE 1: SELECT '01'::json;
               ^
DETAIL:  line 1: Token "01" is invalid.
SELECT '0.1'::json;				-- OK
 json 
------
 0.1
(1 row)

SELECT '9223372036854775808'::json;	-- OK, even though it's too large for int8
        json         
---------------------
 9223372036854775808
(1 row)

SELECT '1e100'::json;			-- OK
 json  
-------
 1e100
(1 row)

SELECT '1.3e100'::json;			-- OK
  json   
---------
 1.3e100
(1 row)

SELECT '1f2'::json;				-- ERROR
ERROR:  invalid input syntax for type json
LINE 1: SELECT '1f2'::json;
               ^
DETAIL:  line 1: Token "1f2" is invalid.
-- Arrays.
SELECT '[]'::json;				-- OK
 json 
------
 []
(1 row)

SELECT '[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]'::json;  -- OK
                                                                                                   json                                                                                                   
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]
(1 row)

SELECT '[1,2]'::json;			-- OK
 json  
-------
 [1,2]
(1 row)

SELECT '[1,2,]'::json;			-- ERROR, trailing comma
ERROR:  invalid input syntax for type json: "[1,2,]"
LINE 1: SELECT '[1,2,]'::json;
               ^
DETAIL:  line 1: Expected string, number, object, array, true, false, or null, but found "]".
SELECT '[1,2'::json;			-- ERROR, no closing bracket
ERROR:  invalid input syntax for type json: "[1,2"
LINE 1: SELECT '[1,2'::json;
               ^
DETAIL:  The input string ended unexpectedly.
SELECT '[1,[2]'::json;			-- ERROR, no closing bracket
ERROR:  invalid input syntax for type json: "[1,[2]"
LINE 1: SELECT '[1,[2]'::json;
               ^
DETAIL:  The input string ended unexpectedly.
-- Objects.
SELECT '{}'::json;				-- OK
 json 
------
 {}
(1 row)

SELECT '{"abc"}'::json;			-- ERROR, no value
ERROR:  invalid input syntax for type json: "{"abc"}"
LINE 1: SELECT '{"abc"}'::json;
               ^
DETAIL:  line 1: Expected ":", but found "}".
SELECT '{"abc":1}'::json;		-- OK
   json    
-----------
 {"abc":1}
(1 row)

SELECT '{1:"abc"}'::json;		-- ERROR, keys must be strings
ERROR:  invalid input syntax for type json: "{1:"abc"}"
LINE 1: SELECT '{1:"abc"}'::json;
               ^
DETAIL:  line 1: Expected string or "}", but found "1".
SELECT '{"abc",1}'::json;		-- ERROR, wrong separator
ERROR:  invalid input syntax for type json: "{"abc",1}"
LINE 1: SELECT '{"abc",1}'::json;
               ^
DETAIL:  line 1: Expected ":", but found ",".
SELECT '{"abc"=1}'::json;		-- ERROR, totally wrong separator
ERROR:  invalid input syntax for type json
LINE 1: SELECT '{"abc"=1}'::json;
               ^
DETAIL:  line 1: Token "=" is invalid.
SELECT '{"abc"::1}'::json;		-- ERROR, another wrong separator
ERROR:  invalid input syntax for type json: "{"abc"::1}"
LINE 1: SELECT '{"abc"::1}'::json;
               ^
DETAIL:  line 1: Expected string, number, object, array, true, false, or null, but found ":".
SELECT '{"abc":1,"def":2,"ghi":[3,4],"hij":{"klm":5,"nop":[6]}}'::json; -- OK
                          json                           
---------------------------------------------------------
 {"abc":1,"def":2,"ghi":[3,4],"hij":{"klm":5,"nop":[6]}}
(1 row)

SELECT '{"abc":1:2}'::json;		-- ERROR, colon in wrong spot
ERROR:  invalid input syntax for type json: "{"abc":1:2}"
LINE 1: SELECT '{"abc":1:2}'::json;
               ^
DETAIL:  line 1: Expected "," or "}", but found ":".
SELECT '{"abc":1,3}'::json;		-- ERROR, no value
ERROR:  invalid input syntax for type json: "{"abc":1,3}"
LINE 1: SELECT '{"abc":1,3}'::json;
               ^
DETAIL:  line 1: Expected string, but found "3".
-- Miscellaneous stuff.
SELECT 'true'::json;			-- OK
 json 
------
 true
(1 row)

SELECT 'false'::json;			-- OK
 json  
-------
 false
(1 row)

SELECT 'null'::json;			-- OK
 json 
------
 null
(1 row)

SELECT ' true '::json;			-- OK, even with extra whitespace
  json  
--------
  true 
(1 row)

SELECT 'true false'::json;		-- ERROR, too many values
ERROR:  invalid input syntax for type json: "true false"
LINE 1: SELECT 'true false'::json;
               ^
DETAIL:  line 1: Expected end of input, but found "false".
SELECT 'true, false'::json;		-- ERROR, too many values
ERROR:  invalid input syntax for type json: "true, false"
LINE 1: SELECT 'true, false'::json;
               ^
DETAIL:  line 1: Expected end of input, but found ",".
SELECT 'truf'::json;			-- ERROR, not a keyword
ERROR:  invalid input syntax for type json
LINE 1: SELECT 'truf'::json;
               ^
DETAIL:  line 1: Token "truf" is invalid.
SELECT 'trues'::json;			-- ERROR, not a keyword
ERROR:  invalid input syntax for type json
LINE 1: SELECT 'trues'::json;
               ^
DETAIL:  line 1: Token "trues" is invalid.
SELECT ''::json;				-- ERROR, no value
ERROR:  invalid input syntax for type json: ""
LINE 1: SELECT ''::json;
               ^
DETAIL:  The input string ended unexpectedly.
SELECT '    '::json;			-- ERROR, no value
ERROR:  invalid input syntax for type json: "    "
LINE 1: SELECT '    '::json;
               ^
DETAIL:  The input string ended unexpectedly.