Re: remaining sql/json patches
| От | jian he |
|---|---|
| Тема | Re: remaining sql/json patches |
| Дата | |
| Msg-id | CACJufxHrd+JMojiMJdVdeYLib2qyKaR11vP1y+JCSr95y_Y6qQ@mail.gmail.com обсуждение исходный текст |
| Ответ на | Re: remaining sql/json patches (jian he <jian.universality@gmail.com>) |
| Ответы |
Re: remaining sql/json patches
|
| Список | pgsql-hackers |
Hi.
more minor issues.
by searching `elog(ERROR, "unrecognized node type: %d"`
I found that generally enum is cast to int, before printing it out.
I also found a related post at [1].
So I add the typecast to int, before printing it out.
most of the refactored code is unlikely to be reachable, but still.
I also refactored ExecPrepareJsonItemCoercion error message, to make
the error message more explicit.
@@ -4498,7 +4498,9 @@ ExecPrepareJsonItemCoercion(JsonbValue *item,
JsonExprState *jsestate,
if (throw_error)
ereport(ERROR,
errcode(ERRCODE_SQL_JSON_ITEM_CANNOT_BE_CAST_TO_TARGET_TYPE),
- errmsg("SQL/JSON item cannot
be cast to target type"));
+
errcode(ERRCODE_SQL_JSON_ITEM_CANNOT_BE_CAST_TO_TARGET_TYPE),
+ errmsg("SQL/JSON item cannot
be cast to type %s",
+
format_type_be(jsestate->jsexpr->returning->typid)));
+ /*
+ * We abuse CaseTestExpr here as placeholder to pass the result of
+ * evaluating the JSON_VALUE/QUERY jsonpath expression as input to the
+ * coercion expression.
+ */
+ CaseTestExpr *placeholder = makeNode(CaseTestExpr);
typo in comment, should it be `JSON_VALUE/JSON_QUERY`?
[1] https://stackoverflow.com/questions/8012647/can-we-typecast-a-enum-variable-in-c
Вложения
В списке pgsql-hackers по дате отправления: