Commit dd8bea8
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 87b6c3c commit dd8bea8
2 files changed
+34
-12
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4411 | 4411 | | |
4412 | 4412 | | |
4413 | 4413 | | |
4414 | | - | |
4415 | | - | |
4416 | | - | |
| 4414 | + | |
| 4415 | + | |
| 4416 | + | |
| 4417 | + | |
| 4418 | + | |
4417 | 4419 | | |
4418 | 4420 | | |
4419 | 4421 | | |
| |||
4491 | 4493 | | |
4492 | 4494 | | |
4493 | 4495 | | |
| 4496 | + | |
| 4497 | + | |
| 4498 | + | |
4494 | 4499 | | |
4495 | 4500 | | |
4496 | 4501 | | |
| |||
4562 | 4567 | | |
4563 | 4568 | | |
4564 | 4569 | | |
| 4570 | + | |
| 4571 | + | |
| 4572 | + | |
| 4573 | + | |
| 4574 | + | |
| 4575 | + | |
| 4576 | + | |
4565 | 4577 | | |
4566 | | - | |
4567 | | - | |
| 4578 | + | |
| 4579 | + | |
| 4580 | + | |
| 4581 | + | |
4568 | 4582 | | |
4569 | 4583 | | |
4570 | 4584 | | |
| |||
4619 | 4633 | | |
4620 | 4634 | | |
4621 | 4635 | | |
| 4636 | + | |
| 4637 | + | |
| 4638 | + | |
4622 | 4639 | | |
4623 | 4640 | | |
4624 | | - | |
| 4641 | + | |
| 4642 | + | |
| 4643 | + | |
| 4644 | + | |
4625 | 4645 | | |
4626 | 4646 | | |
4627 | 4647 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4550 | 4550 | | |
4551 | 4551 | | |
4552 | 4552 | | |
4553 | | - | |
4554 | | - | |
| 4553 | + | |
| 4554 | + | |
4555 | 4555 | | |
4556 | 4556 | | |
4557 | 4557 | | |
| |||
4560 | 4560 | | |
4561 | 4561 | | |
4562 | 4562 | | |
4563 | | - | |
4564 | | - | |
| 4563 | + | |
| 4564 | + | |
| 4565 | + | |
4565 | 4566 | | |
4566 | 4567 | | |
4567 | 4568 | | |
| |||
4581 | 4582 | | |
4582 | 4583 | | |
4583 | 4584 | | |
4584 | | - | |
| 4585 | + | |
4585 | 4586 | | |
4586 | 4587 | | |
4587 | 4588 | | |
4588 | 4589 | | |
4589 | 4590 | | |
4590 | 4591 | | |
4591 | | - | |
| 4592 | + | |
| 4593 | + | |
4592 | 4594 | | |
4593 | 4595 | | |
4594 | 4596 | | |
| |||
0 commit comments