Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
831f5d11
Commit
831f5d11
authored
May 08, 2018
by
Peter Eisentraut
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refine error messages
"JSON" when not referring to a data type should be upper case.
parent
3a675f72
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
39 additions
and
39 deletions
+39
-39
src/backend/utils/adt/jsonfuncs.c
src/backend/utils/adt/jsonfuncs.c
+5
-5
src/test/regress/expected/json.out
src/test/regress/expected/json.out
+17
-17
src/test/regress/expected/jsonb.out
src/test/regress/expected/jsonb.out
+17
-17
No files found.
src/backend/utils/adt/jsonfuncs.c
View file @
831f5d11
...
...
@@ -2326,12 +2326,12 @@ populate_array_report_expected_array(PopulateArrayContext *ctx, int ndim)
if
(
ctx
->
colname
)
ereport
(
ERROR
,
(
errcode
(
ERRCODE_INVALID_TEXT_REPRESENTATION
),
errmsg
(
"expected
json
array"
),
errmsg
(
"expected
JSON
array"
),
errhint
(
"See the value of key
\"
%s
\"
."
,
ctx
->
colname
)));
else
ereport
(
ERROR
,
(
errcode
(
ERRCODE_INVALID_TEXT_REPRESENTATION
),
errmsg
(
"expected
json
array"
)));
errmsg
(
"expected
JSON
array"
)));
}
else
{
...
...
@@ -2348,13 +2348,13 @@ populate_array_report_expected_array(PopulateArrayContext *ctx, int ndim)
if
(
ctx
->
colname
)
ereport
(
ERROR
,
(
errcode
(
ERRCODE_INVALID_TEXT_REPRESENTATION
),
errmsg
(
"expected
json
array"
),
errmsg
(
"expected
JSON
array"
),
errhint
(
"See the array element %s of key
\"
%s
\"
."
,
indices
.
data
,
ctx
->
colname
)));
else
ereport
(
ERROR
,
(
errcode
(
ERRCODE_INVALID_TEXT_REPRESENTATION
),
errmsg
(
"expected
json
array"
),
errmsg
(
"expected
JSON
array"
),
errhint
(
"See the array element %s."
,
indices
.
data
)));
}
...
...
@@ -2390,7 +2390,7 @@ populate_array_check_dimension(PopulateArrayContext *ctx, int ndim)
else
if
(
ctx
->
dims
[
ndim
]
!=
dim
)
ereport
(
ERROR
,
(
errcode
(
ERRCODE_INVALID_TEXT_REPRESENTATION
),
errmsg
(
"malformed
json
array"
),
errmsg
(
"malformed
JSON
array"
),
errdetail
(
"Multidimensional arrays must have "
"sub-arrays with matching dimensions."
)));
...
...
src/test/regress/expected/json.out
View file @
831f5d11
...
...
@@ -1401,7 +1401,7 @@ SELECT ia FROM json_populate_record(NULL::jsrec, '{"ia": null}') q;
(1 row)
SELECT ia FROM json_populate_record(NULL::jsrec, '{"ia": 123}') q;
ERROR: expected
json
array
ERROR: expected
JSON
array
HINT: See the value of key "ia".
SELECT ia FROM json_populate_record(NULL::jsrec, '{"ia": [1, "2", null, 4]}') q;
ia
...
...
@@ -1416,10 +1416,10 @@ SELECT ia FROM json_populate_record(NULL::jsrec, '{"ia": [[1, 2], [3, 4]]}') q;
(1 row)
SELECT ia FROM json_populate_record(NULL::jsrec, '{"ia": [[1], 2]}') q;
ERROR: expected
json
array
ERROR: expected
JSON
array
HINT: See the array element [1] of key "ia".
SELECT ia FROM json_populate_record(NULL::jsrec, '{"ia": [[1], [2, 3]]}') q;
ERROR: malformed
json
array
ERROR: malformed
JSON
array
DETAIL: Multidimensional arrays must have sub-arrays with matching dimensions.
SELECT ia FROM json_populate_record(NULL::jsrec, '{"ia": "{1,2,3}"}') q;
ia
...
...
@@ -1434,7 +1434,7 @@ SELECT ia1 FROM json_populate_record(NULL::jsrec, '{"ia1": null}') q;
(1 row)
SELECT ia1 FROM json_populate_record(NULL::jsrec, '{"ia1": 123}') q;
ERROR: expected
json
array
ERROR: expected
JSON
array
HINT: See the value of key "ia1".
SELECT ia1 FROM json_populate_record(NULL::jsrec, '{"ia1": [1, "2", null, 4]}') q;
ia1
...
...
@@ -1455,7 +1455,7 @@ SELECT ia1d FROM json_populate_record(NULL::jsrec, '{"ia1d": null}') q;
(1 row)
SELECT ia1d FROM json_populate_record(NULL::jsrec, '{"ia1d": 123}') q;
ERROR: expected
json
array
ERROR: expected
JSON
array
HINT: See the value of key "ia1d".
SELECT ia1d FROM json_populate_record(NULL::jsrec, '{"ia1d": [1, "2", null, 4]}') q;
ERROR: value for domain js_int_array_1d violates check constraint "js_int_array_1d_check"
...
...
@@ -1484,10 +1484,10 @@ SELECT ia2 FROM json_populate_record(NULL::jsrec, '{"ia2": [[], []]}') q;
(1 row)
SELECT ia2 FROM json_populate_record(NULL::jsrec, '{"ia2": [[1, 2], [3]]}') q;
ERROR: malformed
json
array
ERROR: malformed
JSON
array
DETAIL: Multidimensional arrays must have sub-arrays with matching dimensions.
SELECT ia2 FROM json_populate_record(NULL::jsrec, '{"ia2": [[1, 2], 3, 4]}') q;
ERROR: expected
json
array
ERROR: expected
JSON
array
HINT: See the array element [1] of key "ia2".
SELECT ia2d FROM json_populate_record(NULL::jsrec, '{"ia2d": [[1, "2"], [null, 4]]}') q;
ERROR: value for domain js_int_array_2d violates check constraint "js_int_array_2d_check"
...
...
@@ -1528,7 +1528,7 @@ SELECT ia3 FROM json_populate_record(NULL::jsrec, '{"ia3": [ [[1, 2], [3, 4]], [
(1 row)
SELECT ia3 FROM json_populate_record(NULL::jsrec, '{"ia3": [ [[1, 2], [3, 4]], [[5, 6], [7, 8], [9, 10]] ]}') q;
ERROR: malformed
json
array
ERROR: malformed
JSON
array
DETAIL: Multidimensional arrays must have sub-arrays with matching dimensions.
SELECT ta FROM json_populate_record(NULL::jsrec, '{"ta": null}') q;
ta
...
...
@@ -1537,7 +1537,7 @@ SELECT ta FROM json_populate_record(NULL::jsrec, '{"ta": null}') q;
(1 row)
SELECT ta FROM json_populate_record(NULL::jsrec, '{"ta": 123}') q;
ERROR: expected
json
array
ERROR: expected
JSON
array
HINT: See the value of key "ta".
SELECT ta FROM json_populate_record(NULL::jsrec, '{"ta": [1, "2", null, 4]}') q;
ta
...
...
@@ -1546,7 +1546,7 @@ SELECT ta FROM json_populate_record(NULL::jsrec, '{"ta": [1, "2", null, 4]}') q;
(1 row)
SELECT ta FROM json_populate_record(NULL::jsrec, '{"ta": [[1, 2, 3], {"k": "v"}]}') q;
ERROR: expected
json
array
ERROR: expected
JSON
array
HINT: See the array element [1] of key "ta".
SELECT c FROM json_populate_record(NULL::jsrec, '{"c": null}') q;
c
...
...
@@ -1575,7 +1575,7 @@ SELECT ca FROM json_populate_record(NULL::jsrec, '{"ca": null}') q;
(1 row)
SELECT ca FROM json_populate_record(NULL::jsrec, '{"ca": 123}') q;
ERROR: expected
json
array
ERROR: expected
JSON
array
HINT: See the value of key "ca".
SELECT ca FROM json_populate_record(NULL::jsrec, '{"ca": [1, "2", null, 4]}') q;
ca
...
...
@@ -1586,7 +1586,7 @@ SELECT ca FROM json_populate_record(NULL::jsrec, '{"ca": [1, "2", null, 4]}') q;
SELECT ca FROM json_populate_record(NULL::jsrec, '{"ca": ["aaaaaaaaaaaaaaaa"]}') q;
ERROR: value too long for type character(10)
SELECT ca FROM json_populate_record(NULL::jsrec, '{"ca": [[1, 2, 3], {"k": "v"}]}') q;
ERROR: expected
json
array
ERROR: expected
JSON
array
HINT: See the array element [1] of key "ca".
SELECT js FROM json_populate_record(NULL::jsrec, '{"js": null}') q;
js
...
...
@@ -1679,7 +1679,7 @@ SELECT jsa FROM json_populate_record(NULL::jsrec, '{"jsa": null}') q;
(1 row)
SELECT jsa FROM json_populate_record(NULL::jsrec, '{"jsa": 123}') q;
ERROR: expected
json
array
ERROR: expected
JSON
array
HINT: See the value of key "jsa".
SELECT jsa FROM json_populate_record(NULL::jsrec, '{"jsa": [1, "2", null, 4]}') q;
jsa
...
...
@@ -1710,7 +1710,7 @@ SELECT rec FROM json_populate_record(NULL::jsrec, '{"rec": "(abc,42,01.02.2003)"
(1 row)
SELECT reca FROM json_populate_record(NULL::jsrec, '{"reca": 123}') q;
ERROR: expected
json
array
ERROR: expected
JSON
array
HINT: See the value of key "reca".
SELECT reca FROM json_populate_record(NULL::jsrec, '{"reca": [1, 2]}') q;
ERROR: cannot call populate_composite on a scalar
...
...
@@ -2215,7 +2215,7 @@ select * from json_to_record('{"ia": null}') as x(ia _int4);
(1 row)
select * from json_to_record('{"ia": 123}') as x(ia _int4);
ERROR: expected
json
array
ERROR: expected
JSON
array
HINT: See the value of key "ia".
select * from json_to_record('{"ia": [1, "2", null, 4]}') as x(ia _int4);
ia
...
...
@@ -2230,10 +2230,10 @@ select * from json_to_record('{"ia": [[1, 2], [3, 4]]}') as x(ia _int4);
(1 row)
select * from json_to_record('{"ia": [[1], 2]}') as x(ia _int4);
ERROR: expected
json
array
ERROR: expected
JSON
array
HINT: See the array element [1] of key "ia".
select * from json_to_record('{"ia": [[1], [2, 3]]}') as x(ia _int4);
ERROR: malformed
json
array
ERROR: malformed
JSON
array
DETAIL: Multidimensional arrays must have sub-arrays with matching dimensions.
select * from json_to_record('{"ia2": [1, 2, 3]}') as x(ia2 int[][]);
ia2
...
...
src/test/regress/expected/jsonb.out
View file @
831f5d11
...
...
@@ -2090,7 +2090,7 @@ SELECT ia FROM jsonb_populate_record(NULL::jsbrec, '{"ia": null}') q;
(1 row)
SELECT ia FROM jsonb_populate_record(NULL::jsbrec, '{"ia": 123}') q;
ERROR: expected
json
array
ERROR: expected
JSON
array
HINT: See the value of key "ia".
SELECT ia FROM jsonb_populate_record(NULL::jsbrec, '{"ia": [1, "2", null, 4]}') q;
ia
...
...
@@ -2105,10 +2105,10 @@ SELECT ia FROM jsonb_populate_record(NULL::jsbrec, '{"ia": [[1, 2], [3, 4]]}') q
(1 row)
SELECT ia FROM jsonb_populate_record(NULL::jsbrec, '{"ia": [[1], 2]}') q;
ERROR: expected
json
array
ERROR: expected
JSON
array
HINT: See the array element [1] of key "ia".
SELECT ia FROM jsonb_populate_record(NULL::jsbrec, '{"ia": [[1], [2, 3]]}') q;
ERROR: malformed
json
array
ERROR: malformed
JSON
array
DETAIL: Multidimensional arrays must have sub-arrays with matching dimensions.
SELECT ia FROM jsonb_populate_record(NULL::jsbrec, '{"ia": "{1,2,3}"}') q;
ia
...
...
@@ -2123,7 +2123,7 @@ SELECT ia1 FROM jsonb_populate_record(NULL::jsbrec, '{"ia1": null}') q;
(1 row)
SELECT ia1 FROM jsonb_populate_record(NULL::jsbrec, '{"ia1": 123}') q;
ERROR: expected
json
array
ERROR: expected
JSON
array
HINT: See the value of key "ia1".
SELECT ia1 FROM jsonb_populate_record(NULL::jsbrec, '{"ia1": [1, "2", null, 4]}') q;
ia1
...
...
@@ -2144,7 +2144,7 @@ SELECT ia1d FROM jsonb_populate_record(NULL::jsbrec, '{"ia1d": null}') q;
(1 row)
SELECT ia1d FROM jsonb_populate_record(NULL::jsbrec, '{"ia1d": 123}') q;
ERROR: expected
json
array
ERROR: expected
JSON
array
HINT: See the value of key "ia1d".
SELECT ia1d FROM jsonb_populate_record(NULL::jsbrec, '{"ia1d": [1, "2", null, 4]}') q;
ERROR: value for domain jsb_int_array_1d violates check constraint "jsb_int_array_1d_check"
...
...
@@ -2173,10 +2173,10 @@ SELECT ia2 FROM jsonb_populate_record(NULL::jsbrec, '{"ia2": [[], []]}') q;
(1 row)
SELECT ia2 FROM jsonb_populate_record(NULL::jsbrec, '{"ia2": [[1, 2], [3]]}') q;
ERROR: malformed
json
array
ERROR: malformed
JSON
array
DETAIL: Multidimensional arrays must have sub-arrays with matching dimensions.
SELECT ia2 FROM jsonb_populate_record(NULL::jsbrec, '{"ia2": [[1, 2], 3, 4]}') q;
ERROR: expected
json
array
ERROR: expected
JSON
array
HINT: See the array element [1] of key "ia2".
SELECT ia2d FROM jsonb_populate_record(NULL::jsbrec, '{"ia2d": [[1, "2"], [null, 4]]}') q;
ERROR: value for domain jsb_int_array_2d violates check constraint "jsb_int_array_2d_check"
...
...
@@ -2217,7 +2217,7 @@ SELECT ia3 FROM jsonb_populate_record(NULL::jsbrec, '{"ia3": [ [[1, 2], [3, 4]],
(1 row)
SELECT ia3 FROM jsonb_populate_record(NULL::jsbrec, '{"ia3": [ [[1, 2], [3, 4]], [[5, 6], [7, 8], [9, 10]] ]}') q;
ERROR: malformed
json
array
ERROR: malformed
JSON
array
DETAIL: Multidimensional arrays must have sub-arrays with matching dimensions.
SELECT ta FROM jsonb_populate_record(NULL::jsbrec, '{"ta": null}') q;
ta
...
...
@@ -2226,7 +2226,7 @@ SELECT ta FROM jsonb_populate_record(NULL::jsbrec, '{"ta": null}') q;
(1 row)
SELECT ta FROM jsonb_populate_record(NULL::jsbrec, '{"ta": 123}') q;
ERROR: expected
json
array
ERROR: expected
JSON
array
HINT: See the value of key "ta".
SELECT ta FROM jsonb_populate_record(NULL::jsbrec, '{"ta": [1, "2", null, 4]}') q;
ta
...
...
@@ -2235,7 +2235,7 @@ SELECT ta FROM jsonb_populate_record(NULL::jsbrec, '{"ta": [1, "2", null, 4]}')
(1 row)
SELECT ta FROM jsonb_populate_record(NULL::jsbrec, '{"ta": [[1, 2, 3], {"k": "v"}]}') q;
ERROR: expected
json
array
ERROR: expected
JSON
array
HINT: See the array element [1] of key "ta".
SELECT c FROM jsonb_populate_record(NULL::jsbrec, '{"c": null}') q;
c
...
...
@@ -2264,7 +2264,7 @@ SELECT ca FROM jsonb_populate_record(NULL::jsbrec, '{"ca": null}') q;
(1 row)
SELECT ca FROM jsonb_populate_record(NULL::jsbrec, '{"ca": 123}') q;
ERROR: expected
json
array
ERROR: expected
JSON
array
HINT: See the value of key "ca".
SELECT ca FROM jsonb_populate_record(NULL::jsbrec, '{"ca": [1, "2", null, 4]}') q;
ca
...
...
@@ -2275,7 +2275,7 @@ SELECT ca FROM jsonb_populate_record(NULL::jsbrec, '{"ca": [1, "2", null, 4]}')
SELECT ca FROM jsonb_populate_record(NULL::jsbrec, '{"ca": ["aaaaaaaaaaaaaaaa"]}') q;
ERROR: value too long for type character(10)
SELECT ca FROM jsonb_populate_record(NULL::jsbrec, '{"ca": [[1, 2, 3], {"k": "v"}]}') q;
ERROR: expected
json
array
ERROR: expected
JSON
array
HINT: See the array element [1] of key "ca".
SELECT js FROM jsonb_populate_record(NULL::jsbrec, '{"js": null}') q;
js
...
...
@@ -2368,7 +2368,7 @@ SELECT jsa FROM jsonb_populate_record(NULL::jsbrec, '{"jsa": null}') q;
(1 row)
SELECT jsa FROM jsonb_populate_record(NULL::jsbrec, '{"jsa": 123}') q;
ERROR: expected
json
array
ERROR: expected
JSON
array
HINT: See the value of key "jsa".
SELECT jsa FROM jsonb_populate_record(NULL::jsbrec, '{"jsa": [1, "2", null, 4]}') q;
jsa
...
...
@@ -2399,7 +2399,7 @@ SELECT rec FROM jsonb_populate_record(NULL::jsbrec, '{"rec": "(abc,42,01.02.2003
(1 row)
SELECT reca FROM jsonb_populate_record(NULL::jsbrec, '{"reca": 123}') q;
ERROR: expected
json
array
ERROR: expected
JSON
array
HINT: See the value of key "reca".
SELECT reca FROM jsonb_populate_record(NULL::jsbrec, '{"reca": [1, 2]}') q;
ERROR: cannot call populate_composite on a scalar
...
...
@@ -2591,7 +2591,7 @@ select * from jsonb_to_record('{"ia": null}') as x(ia _int4);
(1 row)
select * from jsonb_to_record('{"ia": 123}') as x(ia _int4);
ERROR: expected
json
array
ERROR: expected
JSON
array
HINT: See the value of key "ia".
select * from jsonb_to_record('{"ia": [1, "2", null, 4]}') as x(ia _int4);
ia
...
...
@@ -2606,10 +2606,10 @@ select * from jsonb_to_record('{"ia": [[1, 2], [3, 4]]}') as x(ia _int4);
(1 row)
select * from jsonb_to_record('{"ia": [[1], 2]}') as x(ia _int4);
ERROR: expected
json
array
ERROR: expected
JSON
array
HINT: See the array element [1] of key "ia".
select * from jsonb_to_record('{"ia": [[1], [2, 3]]}') as x(ia _int4);
ERROR: malformed
json
array
ERROR: malformed
JSON
array
DETAIL: Multidimensional arrays must have sub-arrays with matching dimensions.
select * from jsonb_to_record('{"ia2": [1, 2, 3]}') as x(ia2 int[][]);
ia2
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment