pgsql: SQL/JSON: Fix casting for integer EXISTS columns in JSON_TABLE
От | Amit Langote |
---|---|
Тема | pgsql: SQL/JSON: Fix casting for integer EXISTS columns in JSON_TABLE |
Дата | |
Msg-id | E1sYcAU-001pLt-6z@gemulon.postgresql.org обсуждение исходный текст |
Список | pgsql-committers |
SQL/JSON: Fix casting for integer EXISTS columns in JSON_TABLE The current method of coercing the boolean result value of JsonPathExists() to the target type specified for an EXISTS column, which is to call the type's input function via json_populate_type(), leads to an error when the target type is integer, because the integer input function doesn't recognize boolean literal values as valid. Instead use the boolean-to-integer cast function for coercion in that case so that using integer or domains thereof as type for EXISTS columns works. Note that coercion for ON ERROR values TRUE and FALSE already works like that because the parser creates a cast expression including the cast function, but the coercion of the actual result value is not handled by the parser. Tests by Jian He. Reported-by: Jian He <jian.universality@gmail.com> Author: Jian He <jian.universality@gmail.com> Author: Amit Langote <amitlangote09@gmail.com> Discussion: https://postgr.es/m/CACJufxEo4sUjKCYtda0_qt9tazqqKPmF1cqhW9KBOUeJFqQd2g@mail.gmail.com Backpatch-through: 17 Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/7f56eaff2fb0f3541c5c6ef8c1099e7f0618b461 Modified Files -------------- src/backend/executor/execExpr.c | 19 +++++++--- src/backend/executor/execExprInterp.c | 46 ++++++++++++++++++++----- src/include/executor/execExpr.h | 6 +++- src/test/regress/expected/sqljson_jsontable.out | 34 ++++++++++++++++-- src/test/regress/sql/sqljson_jsontable.sql | 13 ++++++- 5 files changed, 102 insertions(+), 16 deletions(-)
В списке pgsql-committers по дате отправления: