forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit5683b34
committed
Ensure plpgsql result tuples have the right composite type marking.
A function that is declared to return a named composite type mustreturn tuple datums that are physically marked as having that type.The plpgsql code path that allowed directly returning an expanded-recorddatum forgot to check that, so that an expanded record marked as typeRECORDOID could be returned if it had a physically-compatible tupdesc.This'd be harmless, I think, if the record value never escaped thecurrent session --- but it's possible for it to get stored into a table,and then subsequent sessions can't interpret the anonymous record type.Fix by flattening the record into a tuple datum and overwriting itstype/typmod fields, if its declared type doesn't match the function'sdeclared type. (In principle it might be possible to just change theexpanded record's stored type ID info, but there are enough trickyconsequences that I didn't want to mess with that, especially not ina back-patched bug fix.)Per bug report from Steve Rogerson. Back-patch to v11 where the bugwas introduced.Discussion:https://postgr.es/m/cbaecae6-7b87-584e-45f6-4d047b92ca2a@yewtc.demon.co.uk1 parent03e7b30 commit5683b34
File tree
3 files changed
+48
-0
lines changed- src/pl/plpgsql/src
- expected
- sql
3 files changed
+48
-0
lines changedLines changed: 13 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
654 | 654 |
| |
655 | 655 |
| |
656 | 656 |
| |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + |
Lines changed: 25 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
808 | 808 |
| |
809 | 809 |
| |
810 | 810 |
| |
| 811 | + | |
| 812 | + | |
| 813 | + | |
| 814 | + | |
| 815 | + | |
| 816 | + | |
| 817 | + | |
| 818 | + | |
| 819 | + | |
| 820 | + | |
| 821 | + | |
| 822 | + | |
| 823 | + | |
| 824 | + | |
| 825 | + | |
| 826 | + | |
| 827 | + | |
| 828 | + | |
| 829 | + | |
| 830 | + | |
| 831 | + | |
| 832 | + | |
| 833 | + | |
| 834 | + | |
| 835 | + | |
811 | 836 |
| |
812 | 837 |
| |
813 | 838 |
| |
|
Lines changed: 10 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
441 | 441 |
| |
442 | 442 |
| |
443 | 443 |
| |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + |
0 commit comments
Comments
(0)