diff options
author | Amit Langote <amitlan@postgresql.org> | 2024-09-06 12:05:40 +0900 |
---|---|---|
committer | Amit Langote <amitlan@postgresql.org> | 2024-09-06 12:05:40 +0900 |
commit | 3a97460970f344660971ee75d7f5a181bf87f633 (patch) | |
tree | 7b05440c28f1ee24565e10d4e938316d6e9d5461 /src/backend/utils/adt/ruleutils.c | |
parent | 565caaa79af9a6b3853b161b0652527e716326b8 (diff) | |
download | postgresql-3a97460970f344660971ee75d7f5a181bf87f633.tar.gz postgresql-3a97460970f344660971ee75d7f5a181bf87f633.zip |
SQL/JSON: Avoid initializing unnecessary ON ERROR / ON EMPTY steps
When the ON ERROR / ON EMPTY behavior is to return NULL, returning
NULL directly from ExecEvalJsonExprPath() suffices. Therefore, there's
no need to create separate steps to check the error/empty flag or
those to evaluate the the constant NULL expression. This speeds up
common cases because the default ON ERROR / ON EMPTY behavior for
JSON_QUERY() and JSON_VALUE() is to return NULL. However, these steps
are necessary if the RETURNING type is a domain, as constraints on the
domain may need to be checked.
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/ruleutils.c')
0 files changed, 0 insertions, 0 deletions