forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit913bbd8
committed
Improve the handling of result type coercions in SQL functions.
Use the parser's standard type coercion machinery to convert theoutput column(s) of a SQL function's final SELECT or RETURNINGto the type(s) they should have according to the function's declaredresult type. We'll allow any case where an assignment-levelcoercion is available. Previously, we failed unless the requiredcoercion was a binary-compatible one (and the documentation ignoredthis, falsely claiming that the types must match exactly).Notably, the coercion now accounts for typmods, so that cases wherea SQL function is declared to return a composite type whose columnsare typmod-constrained now behave as one would expect. Arguablythis aspect is a bug fix, but the overall behavioral change hereseems too large to consider back-patching.A nice side-effect is that functions can now be inlined in afew cases where we previously failed to do so because of typemismatches.Discussion:https://postgr.es/m/18929.1574895430@sss.pgh.pa.us1 parent8dd1511 commit913bbd8
File tree
7 files changed
+656
-332
lines changed- doc/src/sgml
- src
- backend
- catalog
- executor
- optimizer/util
- include/executor
- test/regress
- expected
- sql
7 files changed
+656
-332
lines changedLines changed: 21 additions & 23 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
388 | 388 |
| |
389 | 389 |
| |
390 | 390 |
| |
391 |
| - | |
392 |
| - | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
393 | 397 |
| |
394 | 398 |
| |
395 |
| - | |
| 399 | + | |
396 | 400 |
| |
397 | 401 |
| |
398 | 402 |
| |
399 | 403 |
| |
400 | 404 |
| |
401 | 405 |
| |
402 | 406 |
| |
403 |
| - | |
404 |
| - | |
405 |
| - | |
406 |
| - | |
407 |
| - | |
408 |
| - | |
409 |
| - | |
410 |
| - | |
411 |
| - | |
412 |
| - | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
413 | 411 |
| |
414 | 412 |
| |
415 | 413 |
| |
| |||
503 | 501 |
| |
504 | 502 |
| |
505 | 503 |
| |
506 |
| - | |
507 |
| - | |
| 504 | + | |
| 505 | + | |
508 | 506 |
| |
509 | 507 |
| |
510 | 508 |
| |
511 | 509 |
| |
512 | 510 |
| |
513 |
| - | |
514 |
| - | |
| 511 | + | |
| 512 | + | |
515 | 513 |
| |
516 | 514 |
| |
517 | 515 |
| |
518 |
| - | |
| 516 | + | |
| 517 | + | |
519 | 518 |
| |
520 | 519 |
| |
521 |
| - | |
522 |
| - | |
| 520 | + | |
| 521 | + | |
523 | 522 |
| |
524 | 523 |
| |
525 | 524 |
| |
| |||
542 | 541 |
| |
543 | 542 |
| |
544 | 543 |
| |
545 |
| - | |
546 |
| - | |
| 544 | + | |
547 | 545 |
| |
548 | 546 |
| |
549 | 547 |
| |
| |||
1263 | 1261 |
| |
1264 | 1262 |
| |
1265 | 1263 |
| |
1266 |
| - | |
| 1264 | + | |
1267 | 1265 |
| |
1268 | 1266 |
| |
1269 | 1267 |
| |
|
Lines changed: 8 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
923 | 923 |
| |
924 | 924 |
| |
925 | 925 |
| |
| 926 | + | |
| 927 | + | |
926 | 928 |
| |
927 | 929 |
| |
928 | 930 |
| |
| |||
943 | 945 |
| |
944 | 946 |
| |
945 | 947 |
| |
946 |
| - | |
947 |
| - | |
948 |
| - | |
| 948 | + | |
| 949 | + | |
| 950 | + | |
| 951 | + | |
| 952 | + | |
| 953 | + | |
949 | 954 |
| |
950 | 955 |
| |
951 | 956 |
| |
|
0 commit comments
Comments
(0)