Commit c2d93c3
committed
SQL/JSON: Fix coercion of constructor outputs to types with typmod
Ensure SQL/JSON constructor functions that allow specifying the
target type using the RETURNING clause perform implicit cast to
that type. This ensures that output values that exceed the specified
length produce an error rather than being silently truncated. This
behavior conforms to the SQL standard.
Reported-by: Alvaro Herrera <alvherre@alvh.no-ip.org>
Reviewed-by: Jian He <jian.universality@gmail.com>
Discussion: https://postgr.es/m/202405271326.5a5rprki64aw%40alvherre.pgsql1 parent 065583c commit c2d93c3
File tree
3 files changed
+52
-1
lines changed- src
- backend/parser
- test/regress
- expected
- sql
3 files changed
+52
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3583 | 3583 | | |
3584 | 3584 | | |
3585 | 3585 | | |
| 3586 | + | |
3586 | 3587 | | |
3587 | 3588 | | |
3588 | 3589 | | |
| |||
3611 | 3612 | | |
3612 | 3613 | | |
3613 | 3614 | | |
| 3615 | + | |
| 3616 | + | |
| 3617 | + | |
| 3618 | + | |
| 3619 | + | |
| 3620 | + | |
| 3621 | + | |
3614 | 3622 | | |
3615 | 3623 | | |
3616 | | - | |
| 3624 | + | |
| 3625 | + | |
3617 | 3626 | | |
| 3627 | + | |
3618 | 3628 | | |
3619 | 3629 | | |
3620 | 3630 | | |
| |||
3640 | 3650 | | |
3641 | 3651 | | |
3642 | 3652 | | |
| 3653 | + | |
3643 | 3654 | | |
3644 | 3655 | | |
3645 | 3656 | | |
| |||
3677 | 3688 | | |
3678 | 3689 | | |
3679 | 3690 | | |
| 3691 | + | |
| 3692 | + | |
| 3693 | + | |
| 3694 | + | |
| 3695 | + | |
| 3696 | + | |
| 3697 | + | |
| 3698 | + | |
| 3699 | + | |
| 3700 | + | |
| 3701 | + | |
3680 | 3702 | | |
3681 | 3703 | | |
3682 | 3704 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1278 | 1278 | | |
1279 | 1279 | | |
1280 | 1280 | | |
| 1281 | + | |
| 1282 | + | |
| 1283 | + | |
| 1284 | + | |
| 1285 | + | |
| 1286 | + | |
| 1287 | + | |
| 1288 | + | |
| 1289 | + | |
| 1290 | + | |
| 1291 | + | |
| 1292 | + | |
| 1293 | + | |
| 1294 | + | |
| 1295 | + | |
| 1296 | + | |
| 1297 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
463 | 463 | | |
464 | 464 | | |
465 | 465 | | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
0 commit comments