Skip to content

Commit 4cd8717

Browse files
committed
Improve a couple of sql/json error messages
Fix the grammar in two, and add a hint to one.
1 parent fcdb35c commit 4cd8717

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

src/backend/parser/parse_expr.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4456,7 +4456,7 @@ transformJsonFuncExpr(ParseState *pstate, JsonFuncExpr *func)
44564456
if (jsexpr->returning->typid != JSONBOID)
44574457
ereport(ERROR,
44584458
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
4459-
errmsg("JSON_TABLE() is not yet implemented for json type"),
4459+
errmsg("JSON_TABLE() is not yet implemented for the json type"),
44604460
errhint("Try casting the argument to jsonb"),
44614461
parser_errposition(pstate, func->location)));
44624462

@@ -4466,7 +4466,8 @@ transformJsonFuncExpr(ParseState *pstate, JsonFuncExpr *func)
44664466
if (exprType(contextItemExpr) != JSONBOID)
44674467
ereport(ERROR,
44684468
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
4469-
errmsg("%s() is not yet implemented for json type", func_name),
4469+
errmsg("%s() is not yet implemented for the json type", func_name),
4470+
errhint("Try casting the argument to jsonb"),
44704471
parser_errposition(pstate, func->location)));
44714472

44724473
return (Node *) jsexpr;
Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,24 @@
11
-- JSON_EXISTS
22
SELECT JSON_EXISTS(NULL FORMAT JSON, '$');
3-
ERROR: JSON_EXISTS() is not yet implemented for json type
3+
ERROR: JSON_EXISTS() is not yet implemented for the json type
44
LINE 1: SELECT JSON_EXISTS(NULL FORMAT JSON, '$');
55
^
6+
HINT: Try casting the argument to jsonb
67
-- JSON_VALUE
78
SELECT JSON_VALUE(NULL FORMAT JSON, '$');
8-
ERROR: JSON_VALUE() is not yet implemented for json type
9+
ERROR: JSON_VALUE() is not yet implemented for the json type
910
LINE 1: SELECT JSON_VALUE(NULL FORMAT JSON, '$');
1011
^
12+
HINT: Try casting the argument to jsonb
1113
-- JSON_QUERY
1214
SELECT JSON_QUERY(NULL FORMAT JSON, '$');
13-
ERROR: JSON_QUERY() is not yet implemented for json type
15+
ERROR: JSON_QUERY() is not yet implemented for the json type
1416
LINE 1: SELECT JSON_QUERY(NULL FORMAT JSON, '$');
1517
^
18+
HINT: Try casting the argument to jsonb
1619
-- JSON_TABLE
1720
SELECT * FROM JSON_TABLE(NULL FORMAT JSON, '$' COLUMNS (foo text));
18-
ERROR: JSON_TABLE() is not yet implemented for json type
21+
ERROR: JSON_TABLE() is not yet implemented for the json type
1922
LINE 1: SELECT * FROM JSON_TABLE(NULL FORMAT JSON, '$' COLUMNS (foo ...
2023
^
2124
HINT: Try casting the argument to jsonb

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy