Commit 86d3398
committed
SQL/JSON: Rethink c2d93c3
This essentially reverts c2d93c3 except tests. The problem with
c2d93c3 was that it only changed the casting behavior for types
with typmod, and had coding issues noted in the post-commit review.
This commit changes coerceJsonFuncExpr() to use assignment-level casts
instead of explicit casts to coerce the result of JSON constructor
functions to the specified or the default RETURNING type. Using
assignment-level casts fixes the problem that using explicit casts was
leading to the wrong typmod / length coercion behavior -- truncating
results longer than the specified length instead of erroring out --
which c2d93c3 aimed to solve.
That restricts the set of allowed target types to string types, the
same set that's currently allowed.
Discussion: https://postgr.es/m/202406291824.reofujy7xdj3@alvherre.pgsql1 parent ec67869 commit 86d3398
1 file changed
+10
-24
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3582 | 3582 | | |
3583 | 3583 | | |
3584 | 3584 | | |
3585 | | - | |
3586 | 3585 | | |
3587 | 3586 | | |
3588 | 3587 | | |
| |||
3612 | 3611 | | |
3613 | 3612 | | |
3614 | 3613 | | |
3615 | | - | |
3616 | | - | |
| 3614 | + | |
| 3615 | + | |
| 3616 | + | |
| 3617 | + | |
| 3618 | + | |
| 3619 | + | |
| 3620 | + | |
3617 | 3621 | | |
3618 | | - | |
3619 | | - | |
3620 | | - | |
3621 | | - | |
3622 | 3622 | | |
3623 | | - | |
3624 | | - | |
3625 | | - | |
3626 | | - | |
3627 | | - | |
| 3623 | + | |
| 3624 | + | |
| 3625 | + | |
3628 | 3626 | | |
3629 | 3627 | | |
3630 | 3628 | | |
| |||
3649 | 3647 | | |
3650 | 3648 | | |
3651 | 3649 | | |
3652 | | - | |
3653 | 3650 | | |
3654 | 3651 | | |
3655 | 3652 | | |
| |||
3687 | 3684 | | |
3688 | 3685 | | |
3689 | 3686 | | |
3690 | | - | |
3691 | | - | |
3692 | | - | |
3693 | | - | |
3694 | | - | |
3695 | | - | |
3696 | | - | |
3697 | | - | |
3698 | | - | |
3699 | | - | |
3700 | | - | |
3701 | 3687 | | |
3702 | 3688 | | |
3703 | 3689 | | |
| |||
0 commit comments