forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit23610da
committed
Fix up Perl-to-Postgres datatype conversions in pl/perl.
This patch restores the pre-9.1 behavior that pl/perl functions returningVOID ignore the result value of their last Perl statement. 9.1.0unintentionally threw an error if the last statement returned a reference,as reported by Amit Khandekar.Also, make sure it works to return a string value for a composite type,so long as the string meets the type's input format. We already allowedthe equivalent behavior for arrays, so it seems inconsistent to not allowit for composites.In addition, ensure we throw errors for attempts to return arrays or hasheswhen the function's declared result type is not an array or composite type,respectively. Pre-9.1 versions rather uselessly returned strings likeARRAY(0x221a9a0) or HASH(0x221aa90), while 9.1.0 threw an error for thehash case and returned a garbage value for the array case.Also, clean up assorted grotty coding in Perl array conversion, includinguse of a session-lifespan memory context to accumulate the array value(resulting in session-lifespan memory leak on error), failure to apply thedeclared typmod if any, and failure to detect some cases of non-rectangularmulti-dimensional arrays.Alex Hunsaker and Tom Lane1 parentfb4340c commit23610da
File tree
5 files changed
+289
-130
lines changed- src/pl/plperl
- expected
- sql
5 files changed
+289
-130
lines changedLines changed: 56 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
101 | 101 |
| |
102 | 102 |
| |
103 | 103 |
| |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
104 | 114 |
| |
105 | 115 |
| |
106 | 116 |
| |
| |||
336 | 346 |
| |
337 | 347 |
| |
338 | 348 |
| |
339 |
| - | |
| 349 | + | |
| 350 | + | |
340 | 351 |
| |
341 | 352 |
| |
342 | 353 |
| |
| |||
345 | 356 |
| |
346 | 357 |
| |
347 | 358 |
| |
348 |
| - | |
| 359 | + | |
349 | 360 |
| |
350 | 361 |
| |
351 | 362 |
| |
| |||
639 | 650 |
| |
640 | 651 |
| |
641 | 652 |
| |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
| 695 | + |
Lines changed: 10 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
204 | 204 |
| |
205 | 205 |
| |
206 | 206 |
| |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
207 | 217 |
| |
208 | 218 |
| |
209 | 219 |
| |
|
0 commit comments
Comments
(0)