Commit 3a97460
committed
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: 171 parent 565caaa commit 3a97460
1 file changed
+22
-8
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4414 | 4414 | | |
4415 | 4415 | | |
4416 | 4416 | | |
| 4417 | + | |
| 4418 | + | |
4417 | 4419 | | |
4418 | 4420 | | |
4419 | 4421 | | |
| |||
4556 | 4558 | | |
4557 | 4559 | | |
4558 | 4560 | | |
4559 | | - | |
4560 | | - | |
4561 | 4561 | | |
4562 | 4562 | | |
4563 | 4563 | | |
4564 | 4564 | | |
| 4565 | + | |
| 4566 | + | |
| 4567 | + | |
| 4568 | + | |
| 4569 | + | |
| 4570 | + | |
| 4571 | + | |
4565 | 4572 | | |
| 4573 | + | |
4566 | 4574 | | |
4567 | | - | |
| 4575 | + | |
| 4576 | + | |
| 4577 | + | |
| 4578 | + | |
4568 | 4579 | | |
4569 | 4580 | | |
4570 | 4581 | | |
4571 | | - | |
4572 | | - | |
4573 | 4582 | | |
4574 | 4583 | | |
4575 | 4584 | | |
| |||
4619 | 4628 | | |
4620 | 4629 | | |
4621 | 4630 | | |
| 4631 | + | |
| 4632 | + | |
| 4633 | + | |
4622 | 4634 | | |
| 4635 | + | |
4623 | 4636 | | |
4624 | | - | |
| 4637 | + | |
| 4638 | + | |
| 4639 | + | |
| 4640 | + | |
4625 | 4641 | | |
4626 | 4642 | | |
4627 | 4643 | | |
4628 | | - | |
4629 | | - | |
4630 | 4644 | | |
4631 | 4645 | | |
4632 | 4646 | | |
| |||
0 commit comments