Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit831f5d1

Browse files
committed
Refine error messages
"JSON" when not referring to a data type should be upper case.
1 parent3a675f7 commit831f5d1

File tree

3 files changed

+39
-39
lines changed

3 files changed

+39
-39
lines changed

‎src/backend/utils/adt/jsonfuncs.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2326,12 +2326,12 @@ populate_array_report_expected_array(PopulateArrayContext *ctx, int ndim)
23262326
if (ctx->colname)
23272327
ereport(ERROR,
23282328
(errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
2329-
errmsg("expectedjson array"),
2329+
errmsg("expectedJSON array"),
23302330
errhint("See the value of key \"%s\".",ctx->colname)));
23312331
else
23322332
ereport(ERROR,
23332333
(errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
2334-
errmsg("expectedjson array")));
2334+
errmsg("expectedJSON array")));
23352335
}
23362336
else
23372337
{
@@ -2348,13 +2348,13 @@ populate_array_report_expected_array(PopulateArrayContext *ctx, int ndim)
23482348
if (ctx->colname)
23492349
ereport(ERROR,
23502350
(errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
2351-
errmsg("expectedjson array"),
2351+
errmsg("expectedJSON array"),
23522352
errhint("See the array element %s of key \"%s\".",
23532353
indices.data,ctx->colname)));
23542354
else
23552355
ereport(ERROR,
23562356
(errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
2357-
errmsg("expectedjson array"),
2357+
errmsg("expectedJSON array"),
23582358
errhint("See the array element %s.",
23592359
indices.data)));
23602360
}
@@ -2390,7 +2390,7 @@ populate_array_check_dimension(PopulateArrayContext *ctx, int ndim)
23902390
elseif (ctx->dims[ndim]!=dim)
23912391
ereport(ERROR,
23922392
(errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
2393-
errmsg("malformedjson array"),
2393+
errmsg("malformedJSON array"),
23942394
errdetail("Multidimensional arrays must have "
23952395
"sub-arrays with matching dimensions.")));
23962396

‎src/test/regress/expected/json.out

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1401,7 +1401,7 @@ SELECT ia FROM json_populate_record(NULL::jsrec, '{"ia": null}') q;
14011401
(1 row)
14021402

14031403
SELECT ia FROM json_populate_record(NULL::jsrec, '{"ia": 123}') q;
1404-
ERROR: expectedjson array
1404+
ERROR: expectedJSON array
14051405
HINT: See the value of key "ia".
14061406
SELECT ia FROM json_populate_record(NULL::jsrec, '{"ia": [1, "2", null, 4]}') q;
14071407
ia
@@ -1416,10 +1416,10 @@ SELECT ia FROM json_populate_record(NULL::jsrec, '{"ia": [[1, 2], [3, 4]]}') q;
14161416
(1 row)
14171417

14181418
SELECT ia FROM json_populate_record(NULL::jsrec, '{"ia": [[1], 2]}') q;
1419-
ERROR: expectedjson array
1419+
ERROR: expectedJSON array
14201420
HINT: See the array element [1] of key "ia".
14211421
SELECT ia FROM json_populate_record(NULL::jsrec, '{"ia": [[1], [2, 3]]}') q;
1422-
ERROR: malformedjson array
1422+
ERROR: malformedJSON array
14231423
DETAIL: Multidimensional arrays must have sub-arrays with matching dimensions.
14241424
SELECT ia FROM json_populate_record(NULL::jsrec, '{"ia": "{1,2,3}"}') q;
14251425
ia
@@ -1434,7 +1434,7 @@ SELECT ia1 FROM json_populate_record(NULL::jsrec, '{"ia1": null}') q;
14341434
(1 row)
14351435

14361436
SELECT ia1 FROM json_populate_record(NULL::jsrec, '{"ia1": 123}') q;
1437-
ERROR: expectedjson array
1437+
ERROR: expectedJSON array
14381438
HINT: See the value of key "ia1".
14391439
SELECT ia1 FROM json_populate_record(NULL::jsrec, '{"ia1": [1, "2", null, 4]}') q;
14401440
ia1
@@ -1455,7 +1455,7 @@ SELECT ia1d FROM json_populate_record(NULL::jsrec, '{"ia1d": null}') q;
14551455
(1 row)
14561456

14571457
SELECT ia1d FROM json_populate_record(NULL::jsrec, '{"ia1d": 123}') q;
1458-
ERROR: expectedjson array
1458+
ERROR: expectedJSON array
14591459
HINT: See the value of key "ia1d".
14601460
SELECT ia1d FROM json_populate_record(NULL::jsrec, '{"ia1d": [1, "2", null, 4]}') q;
14611461
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;
14841484
(1 row)
14851485

14861486
SELECT ia2 FROM json_populate_record(NULL::jsrec, '{"ia2": [[1, 2], [3]]}') q;
1487-
ERROR: malformedjson array
1487+
ERROR: malformedJSON array
14881488
DETAIL: Multidimensional arrays must have sub-arrays with matching dimensions.
14891489
SELECT ia2 FROM json_populate_record(NULL::jsrec, '{"ia2": [[1, 2], 3, 4]}') q;
1490-
ERROR: expectedjson array
1490+
ERROR: expectedJSON array
14911491
HINT: See the array element [1] of key "ia2".
14921492
SELECT ia2d FROM json_populate_record(NULL::jsrec, '{"ia2d": [[1, "2"], [null, 4]]}') q;
14931493
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]], [
15281528
(1 row)
15291529

15301530
SELECT ia3 FROM json_populate_record(NULL::jsrec, '{"ia3": [ [[1, 2], [3, 4]], [[5, 6], [7, 8], [9, 10]] ]}') q;
1531-
ERROR: malformedjson array
1531+
ERROR: malformedJSON array
15321532
DETAIL: Multidimensional arrays must have sub-arrays with matching dimensions.
15331533
SELECT ta FROM json_populate_record(NULL::jsrec, '{"ta": null}') q;
15341534
ta
@@ -1537,7 +1537,7 @@ SELECT ta FROM json_populate_record(NULL::jsrec, '{"ta": null}') q;
15371537
(1 row)
15381538

15391539
SELECT ta FROM json_populate_record(NULL::jsrec, '{"ta": 123}') q;
1540-
ERROR: expectedjson array
1540+
ERROR: expectedJSON array
15411541
HINT: See the value of key "ta".
15421542
SELECT ta FROM json_populate_record(NULL::jsrec, '{"ta": [1, "2", null, 4]}') q;
15431543
ta
@@ -1546,7 +1546,7 @@ SELECT ta FROM json_populate_record(NULL::jsrec, '{"ta": [1, "2", null, 4]}') q;
15461546
(1 row)
15471547

15481548
SELECT ta FROM json_populate_record(NULL::jsrec, '{"ta": [[1, 2, 3], {"k": "v"}]}') q;
1549-
ERROR: expectedjson array
1549+
ERROR: expectedJSON array
15501550
HINT: See the array element [1] of key "ta".
15511551
SELECT c FROM json_populate_record(NULL::jsrec, '{"c": null}') q;
15521552
c
@@ -1575,7 +1575,7 @@ SELECT ca FROM json_populate_record(NULL::jsrec, '{"ca": null}') q;
15751575
(1 row)
15761576

15771577
SELECT ca FROM json_populate_record(NULL::jsrec, '{"ca": 123}') q;
1578-
ERROR: expectedjson array
1578+
ERROR: expectedJSON array
15791579
HINT: See the value of key "ca".
15801580
SELECT ca FROM json_populate_record(NULL::jsrec, '{"ca": [1, "2", null, 4]}') q;
15811581
ca
@@ -1586,7 +1586,7 @@ SELECT ca FROM json_populate_record(NULL::jsrec, '{"ca": [1, "2", null, 4]}') q;
15861586
SELECT ca FROM json_populate_record(NULL::jsrec, '{"ca": ["aaaaaaaaaaaaaaaa"]}') q;
15871587
ERROR: value too long for type character(10)
15881588
SELECT ca FROM json_populate_record(NULL::jsrec, '{"ca": [[1, 2, 3], {"k": "v"}]}') q;
1589-
ERROR: expectedjson array
1589+
ERROR: expectedJSON array
15901590
HINT: See the array element [1] of key "ca".
15911591
SELECT js FROM json_populate_record(NULL::jsrec, '{"js": null}') q;
15921592
js
@@ -1679,7 +1679,7 @@ SELECT jsa FROM json_populate_record(NULL::jsrec, '{"jsa": null}') q;
16791679
(1 row)
16801680

16811681
SELECT jsa FROM json_populate_record(NULL::jsrec, '{"jsa": 123}') q;
1682-
ERROR: expectedjson array
1682+
ERROR: expectedJSON array
16831683
HINT: See the value of key "jsa".
16841684
SELECT jsa FROM json_populate_record(NULL::jsrec, '{"jsa": [1, "2", null, 4]}') q;
16851685
jsa
@@ -1710,7 +1710,7 @@ SELECT rec FROM json_populate_record(NULL::jsrec, '{"rec": "(abc,42,01.02.2003)"
17101710
(1 row)
17111711

17121712
SELECT reca FROM json_populate_record(NULL::jsrec, '{"reca": 123}') q;
1713-
ERROR: expectedjson array
1713+
ERROR: expectedJSON array
17141714
HINT: See the value of key "reca".
17151715
SELECT reca FROM json_populate_record(NULL::jsrec, '{"reca": [1, 2]}') q;
17161716
ERROR: cannot call populate_composite on a scalar
@@ -2215,7 +2215,7 @@ select * from json_to_record('{"ia": null}') as x(ia _int4);
22152215
(1 row)
22162216

22172217
select * from json_to_record('{"ia": 123}') as x(ia _int4);
2218-
ERROR: expectedjson array
2218+
ERROR: expectedJSON array
22192219
HINT: See the value of key "ia".
22202220
select * from json_to_record('{"ia": [1, "2", null, 4]}') as x(ia _int4);
22212221
ia
@@ -2230,10 +2230,10 @@ select * from json_to_record('{"ia": [[1, 2], [3, 4]]}') as x(ia _int4);
22302230
(1 row)
22312231

22322232
select * from json_to_record('{"ia": [[1], 2]}') as x(ia _int4);
2233-
ERROR: expectedjson array
2233+
ERROR: expectedJSON array
22342234
HINT: See the array element [1] of key "ia".
22352235
select * from json_to_record('{"ia": [[1], [2, 3]]}') as x(ia _int4);
2236-
ERROR: malformedjson array
2236+
ERROR: malformedJSON array
22372237
DETAIL: Multidimensional arrays must have sub-arrays with matching dimensions.
22382238
select * from json_to_record('{"ia2": [1, 2, 3]}') as x(ia2 int[][]);
22392239
ia2

‎src/test/regress/expected/jsonb.out

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2090,7 +2090,7 @@ SELECT ia FROM jsonb_populate_record(NULL::jsbrec, '{"ia": null}') q;
20902090
(1 row)
20912091

20922092
SELECT ia FROM jsonb_populate_record(NULL::jsbrec, '{"ia": 123}') q;
2093-
ERROR: expectedjson array
2093+
ERROR: expectedJSON array
20942094
HINT: See the value of key "ia".
20952095
SELECT ia FROM jsonb_populate_record(NULL::jsbrec, '{"ia": [1, "2", null, 4]}') q;
20962096
ia
@@ -2105,10 +2105,10 @@ SELECT ia FROM jsonb_populate_record(NULL::jsbrec, '{"ia": [[1, 2], [3, 4]]}') q
21052105
(1 row)
21062106

21072107
SELECT ia FROM jsonb_populate_record(NULL::jsbrec, '{"ia": [[1], 2]}') q;
2108-
ERROR: expectedjson array
2108+
ERROR: expectedJSON array
21092109
HINT: See the array element [1] of key "ia".
21102110
SELECT ia FROM jsonb_populate_record(NULL::jsbrec, '{"ia": [[1], [2, 3]]}') q;
2111-
ERROR: malformedjson array
2111+
ERROR: malformedJSON array
21122112
DETAIL: Multidimensional arrays must have sub-arrays with matching dimensions.
21132113
SELECT ia FROM jsonb_populate_record(NULL::jsbrec, '{"ia": "{1,2,3}"}') q;
21142114
ia
@@ -2123,7 +2123,7 @@ SELECT ia1 FROM jsonb_populate_record(NULL::jsbrec, '{"ia1": null}') q;
21232123
(1 row)
21242124

21252125
SELECT ia1 FROM jsonb_populate_record(NULL::jsbrec, '{"ia1": 123}') q;
2126-
ERROR: expectedjson array
2126+
ERROR: expectedJSON array
21272127
HINT: See the value of key "ia1".
21282128
SELECT ia1 FROM jsonb_populate_record(NULL::jsbrec, '{"ia1": [1, "2", null, 4]}') q;
21292129
ia1
@@ -2144,7 +2144,7 @@ SELECT ia1d FROM jsonb_populate_record(NULL::jsbrec, '{"ia1d": null}') q;
21442144
(1 row)
21452145

21462146
SELECT ia1d FROM jsonb_populate_record(NULL::jsbrec, '{"ia1d": 123}') q;
2147-
ERROR: expectedjson array
2147+
ERROR: expectedJSON array
21482148
HINT: See the value of key "ia1d".
21492149
SELECT ia1d FROM jsonb_populate_record(NULL::jsbrec, '{"ia1d": [1, "2", null, 4]}') q;
21502150
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;
21732173
(1 row)
21742174

21752175
SELECT ia2 FROM jsonb_populate_record(NULL::jsbrec, '{"ia2": [[1, 2], [3]]}') q;
2176-
ERROR: malformedjson array
2176+
ERROR: malformedJSON array
21772177
DETAIL: Multidimensional arrays must have sub-arrays with matching dimensions.
21782178
SELECT ia2 FROM jsonb_populate_record(NULL::jsbrec, '{"ia2": [[1, 2], 3, 4]}') q;
2179-
ERROR: expectedjson array
2179+
ERROR: expectedJSON array
21802180
HINT: See the array element [1] of key "ia2".
21812181
SELECT ia2d FROM jsonb_populate_record(NULL::jsbrec, '{"ia2d": [[1, "2"], [null, 4]]}') q;
21822182
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]],
22172217
(1 row)
22182218

22192219
SELECT ia3 FROM jsonb_populate_record(NULL::jsbrec, '{"ia3": [ [[1, 2], [3, 4]], [[5, 6], [7, 8], [9, 10]] ]}') q;
2220-
ERROR: malformedjson array
2220+
ERROR: malformedJSON array
22212221
DETAIL: Multidimensional arrays must have sub-arrays with matching dimensions.
22222222
SELECT ta FROM jsonb_populate_record(NULL::jsbrec, '{"ta": null}') q;
22232223
ta
@@ -2226,7 +2226,7 @@ SELECT ta FROM jsonb_populate_record(NULL::jsbrec, '{"ta": null}') q;
22262226
(1 row)
22272227

22282228
SELECT ta FROM jsonb_populate_record(NULL::jsbrec, '{"ta": 123}') q;
2229-
ERROR: expectedjson array
2229+
ERROR: expectedJSON array
22302230
HINT: See the value of key "ta".
22312231
SELECT ta FROM jsonb_populate_record(NULL::jsbrec, '{"ta": [1, "2", null, 4]}') q;
22322232
ta
@@ -2235,7 +2235,7 @@ SELECT ta FROM jsonb_populate_record(NULL::jsbrec, '{"ta": [1, "2", null, 4]}')
22352235
(1 row)
22362236

22372237
SELECT ta FROM jsonb_populate_record(NULL::jsbrec, '{"ta": [[1, 2, 3], {"k": "v"}]}') q;
2238-
ERROR: expectedjson array
2238+
ERROR: expectedJSON array
22392239
HINT: See the array element [1] of key "ta".
22402240
SELECT c FROM jsonb_populate_record(NULL::jsbrec, '{"c": null}') q;
22412241
c
@@ -2264,7 +2264,7 @@ SELECT ca FROM jsonb_populate_record(NULL::jsbrec, '{"ca": null}') q;
22642264
(1 row)
22652265

22662266
SELECT ca FROM jsonb_populate_record(NULL::jsbrec, '{"ca": 123}') q;
2267-
ERROR: expectedjson array
2267+
ERROR: expectedJSON array
22682268
HINT: See the value of key "ca".
22692269
SELECT ca FROM jsonb_populate_record(NULL::jsbrec, '{"ca": [1, "2", null, 4]}') q;
22702270
ca
@@ -2275,7 +2275,7 @@ SELECT ca FROM jsonb_populate_record(NULL::jsbrec, '{"ca": [1, "2", null, 4]}')
22752275
SELECT ca FROM jsonb_populate_record(NULL::jsbrec, '{"ca": ["aaaaaaaaaaaaaaaa"]}') q;
22762276
ERROR: value too long for type character(10)
22772277
SELECT ca FROM jsonb_populate_record(NULL::jsbrec, '{"ca": [[1, 2, 3], {"k": "v"}]}') q;
2278-
ERROR: expectedjson array
2278+
ERROR: expectedJSON array
22792279
HINT: See the array element [1] of key "ca".
22802280
SELECT js FROM jsonb_populate_record(NULL::jsbrec, '{"js": null}') q;
22812281
js
@@ -2368,7 +2368,7 @@ SELECT jsa FROM jsonb_populate_record(NULL::jsbrec, '{"jsa": null}') q;
23682368
(1 row)
23692369

23702370
SELECT jsa FROM jsonb_populate_record(NULL::jsbrec, '{"jsa": 123}') q;
2371-
ERROR: expectedjson array
2371+
ERROR: expectedJSON array
23722372
HINT: See the value of key "jsa".
23732373
SELECT jsa FROM jsonb_populate_record(NULL::jsbrec, '{"jsa": [1, "2", null, 4]}') q;
23742374
jsa
@@ -2399,7 +2399,7 @@ SELECT rec FROM jsonb_populate_record(NULL::jsbrec, '{"rec": "(abc,42,01.02.2003
23992399
(1 row)
24002400

24012401
SELECT reca FROM jsonb_populate_record(NULL::jsbrec, '{"reca": 123}') q;
2402-
ERROR: expectedjson array
2402+
ERROR: expectedJSON array
24032403
HINT: See the value of key "reca".
24042404
SELECT reca FROM jsonb_populate_record(NULL::jsbrec, '{"reca": [1, 2]}') q;
24052405
ERROR: cannot call populate_composite on a scalar
@@ -2591,7 +2591,7 @@ select * from jsonb_to_record('{"ia": null}') as x(ia _int4);
25912591
(1 row)
25922592

25932593
select * from jsonb_to_record('{"ia": 123}') as x(ia _int4);
2594-
ERROR: expectedjson array
2594+
ERROR: expectedJSON array
25952595
HINT: See the value of key "ia".
25962596
select * from jsonb_to_record('{"ia": [1, "2", null, 4]}') as x(ia _int4);
25972597
ia
@@ -2606,10 +2606,10 @@ select * from jsonb_to_record('{"ia": [[1, 2], [3, 4]]}') as x(ia _int4);
26062606
(1 row)
26072607

26082608
select * from jsonb_to_record('{"ia": [[1], 2]}') as x(ia _int4);
2609-
ERROR: expectedjson array
2609+
ERROR: expectedJSON array
26102610
HINT: See the array element [1] of key "ia".
26112611
select * from jsonb_to_record('{"ia": [[1], [2, 3]]}') as x(ia _int4);
2612-
ERROR: malformedjson array
2612+
ERROR: malformedJSON array
26132613
DETAIL: Multidimensional arrays must have sub-arrays with matching dimensions.
26142614
select * from jsonb_to_record('{"ia2": [1, 2, 3]}') as x(ia2 int[][]);
26152615
ia2

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp