Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 976b06c

Browse files
committed
Add another SQL/JSON error code
A code comment said that the standard does not define a number for ERRCODE_SQL_JSON_ITEM_CANNOT_BE_CAST_TO_TARGET_TYPE, but this was fixed in a later draft version of the standard, so use that number now.
1 parent f58d707 commit 976b06c

File tree

2 files changed

+2
-7
lines changed

2 files changed

+2
-7
lines changed

src/backend/executor/execExprInterp.c

+1-7
Original file line numberDiff line numberDiff line change
@@ -4980,13 +4980,7 @@ ExecEvalJsonExpr(ExprEvalStep *op, ExprContext *econtext,
49804980
* type simply does not exist.
49814981
*/
49824982
ereport(ERROR,
4983-
4984-
/*
4985-
* XXX Standard says about a separate error code
4986-
* ERRCODE_SQL_JSON_ITEM_CANNOT_BE_CAST_TO_TARGET_TYPE but
4987-
* does not define its number.
4988-
*/
4989-
(errcode(ERRCODE_SQL_JSON_SCALAR_REQUIRED),
4983+
(errcode(ERRCODE_SQL_JSON_ITEM_CANNOT_BE_CAST_TO_TARGET_TYPE),
49904984
errmsg("SQL/JSON item cannot be cast to target type")));
49914985
}
49924986
else if (!jcstate->estate)

src/backend/utils/errcodes.txt

+1
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,7 @@ Section: Class 22 - Data Exception
222222
2203D E ERRCODE_TOO_MANY_JSON_ARRAY_ELEMENTS too_many_json_array_elements
223223
2203E E ERRCODE_TOO_MANY_JSON_OBJECT_MEMBERS too_many_json_object_members
224224
2203F E ERRCODE_SQL_JSON_SCALAR_REQUIRED sql_json_scalar_required
225+
2203G E ERRCODE_SQL_JSON_ITEM_CANNOT_BE_CAST_TO_TARGET_TYPE sql_json_item_cannot_be_cast_to_target_type
225226

226227
Section: Class 23 - Integrity Constraint Violation
227228

0 commit comments

Comments
 (0)