aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/adt/jsonpath_exec.c
diff options
context:
space:
mode:
authorAmit Langote <amitlan@postgresql.org>2024-07-30 10:12:23 +0900
committerAmit Langote <amitlan@postgresql.org>2024-07-30 10:39:28 +0900
commitf95c5090d975c3f552823f1f6895193d5da19825 (patch)
tree1c184da47e4a3817c162a866beaf7826b3ddfe8a /src/backend/utils/adt/jsonpath_exec.c
parent847ee701bd3a6d222ab8f67923e308ee1a70a2f8 (diff)
downloadpostgresql-f95c5090d975c3f552823f1f6895193d5da19825.tar.gz
postgresql-f95c5090d975c3f552823f1f6895193d5da19825.zip
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
Diffstat (limited to 'src/backend/utils/adt/jsonpath_exec.c')
0 files changed, 0 insertions, 0 deletions