- Notifications
You must be signed in to change notification settings - Fork5
Commitba3e415
committed
PL/Python: Accept strings in functions returning composite types
Before 9.1, PL/Python functions returning composite types could returna string and it would be parsed using record_in. The 9.1 changes madePL/Python only expect dictionaries, tuples, or objects supportinggetattr as output of composite functions, resulting in a regressionand a confusing error message, as the strings were interpreted assequences and the code for transforming lists to database tuples wasused. Fix this by treating strings separately as before, beforechecking for the other types.The reason why it's important to support string to database tupleconversion is that trigger functions on tables with composite columnsget the composite row passed in as a string (from record_out).Without supporting converting this back using record_in, this makes itimpossible to implement pass-through behavior for these columns, asPL/Python no longer accepts strings for composite values.A better solution would be to fix the code that transforms compositeinputs into Python objects to produce dictionaries that would then becorrectly interpreted by the Python->PostgreSQL counterpart code. Butthat would be too invasive to backpatch to 9.1, and it is too late inthe 9.2 cycle to attempt it. It should be revisited in the future,though.Reported as bug #6559 by Kirill Simonov.Jan Urbański1 parentcc71cea commitba3e415
File tree
7 files changed
+151
-47
lines changed- src/pl/plpython
- expected
- sql
7 files changed
+151
-47
lines changedLines changed: 16 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
38 | 38 |
| |
39 | 39 |
| |
40 | 40 |
| |
| 41 | + | |
| 42 | + | |
41 | 43 |
| |
42 | 44 |
| |
43 | 45 |
| |
| |||
290 | 292 |
| |
291 | 293 |
| |
292 | 294 |
| |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
293 | 301 |
| |
294 | 302 |
| |
295 | 303 |
| |
| |||
355 | 363 |
| |
356 | 364 |
| |
357 | 365 |
| |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + |
Lines changed: 37 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
567 | 567 |
| |
568 | 568 |
| |
569 | 569 |
| |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + |
Lines changed: 3 additions & 14 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
180 | 180 |
| |
181 | 181 |
| |
182 | 182 |
| |
183 |
| - | |
184 |
| - | |
| 183 | + | |
185 | 184 |
| |
186 | 185 |
| |
187 | 186 |
| |
| |||
192 | 191 |
| |
193 | 192 |
| |
194 | 193 |
| |
195 |
| - | |
196 |
| - | |
197 |
| - | |
198 |
| - | |
199 |
| - | |
200 |
| - | |
201 |
| - | |
202 |
| - | |
203 |
| - | |
204 |
| - | |
205 |
| - | |
206 |
| - | |
| 194 | + | |
| 195 | + | |
207 | 196 |
| |
208 | 197 |
| |
209 | 198 |
| |
|
Lines changed: 47 additions & 31 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
49 | 49 |
| |
50 | 50 |
| |
51 | 51 |
| |
52 |
| - | |
53 |
| - | |
54 |
| - | |
55 |
| - | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
56 | 57 |
| |
57 | 58 |
| |
58 | 59 |
| |
| |||
333 | 334 |
| |
334 | 335 |
| |
335 | 336 |
| |
336 |
| - | |
337 |
| - | |
338 |
| - | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
339 | 340 |
| |
340 |
| - | |
341 |
| - | |
| 341 | + | |
| 342 | + | |
342 | 343 |
| |
343 |
| - | |
| 344 | + | |
344 | 345 |
| |
345 |
| - | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
346 | 349 |
| |
347 |
| - | |
| 350 | + | |
348 | 351 |
| |
349 | 352 |
| |
350 |
| - | |
| 353 | + | |
351 | 354 |
| |
352 | 355 |
| |
353 |
| - | |
| 356 | + | |
354 | 357 |
| |
355 |
| - | |
| 358 | + | |
356 | 359 |
| |
357 | 360 |
| |
358 | 361 |
| |
| |||
681 | 684 |
| |
682 | 685 |
| |
683 | 686 |
| |
684 |
| - | |
685 | 687 |
| |
686 | 688 |
| |
687 | 689 |
| |
| |||
703 | 705 |
| |
704 | 706 |
| |
705 | 707 |
| |
706 |
| - | |
| 708 | + | |
707 | 709 |
| |
708 | 710 |
| |
709 | 711 |
| |
710 |
| - | |
711 |
| - | |
712 |
| - | |
713 |
| - | |
714 |
| - | |
715 | 712 |
| |
716 | 713 |
| |
717 | 714 |
| |
| |||
818 | 815 |
| |
819 | 816 |
| |
820 | 817 |
| |
821 |
| - | |
822 |
| - | |
| 818 | + | |
| 819 | + | |
| 820 | + | |
| 821 | + | |
| 822 | + | |
| 823 | + | |
| 824 | + | |
| 825 | + | |
| 826 | + | |
| 827 | + | |
| 828 | + | |
| 829 | + | |
| 830 | + | |
| 831 | + | |
| 832 | + | |
| 833 | + | |
| 834 | + | |
| 835 | + | |
| 836 | + | |
| 837 | + | |
| 838 | + | |
823 | 839 |
| |
824 | 840 |
| |
825 | 841 |
| |
| |||
887 | 903 |
| |
888 | 904 |
| |
889 | 905 |
| |
890 |
| - | |
| 906 | + | |
891 | 907 |
| |
892 | 908 |
| |
893 | 909 |
| |
894 |
| - | |
895 |
| - | |
| 910 | + | |
| 911 | + | |
896 | 912 |
| |
897 | 913 |
| |
898 | 914 |
| |
| |||
973 | 989 |
| |
974 | 990 |
| |
975 | 991 |
| |
976 |
| - | |
| 992 | + | |
977 | 993 |
| |
978 | 994 |
| |
979 | 995 |
| |
980 |
| - | |
981 |
| - | |
| 996 | + | |
| 997 | + | |
982 | 998 |
| |
983 | 999 |
| |
984 | 1000 |
| |
| |||
1045 | 1061 |
| |
1046 | 1062 |
| |
1047 | 1063 |
| |
1048 |
| - | |
| 1064 | + | |
1049 | 1065 |
| |
1050 | 1066 |
| |
1051 | 1067 |
| |
|
Lines changed: 2 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
98 | 98 |
| |
99 | 99 |
| |
100 | 100 |
| |
101 |
| - | |
102 |
| - | |
| 101 | + | |
| 102 | + | |
103 | 103 |
| |
104 | 104 |
| |
105 | 105 |
| |
|
Lines changed: 10 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
43 | 43 |
| |
44 | 44 |
| |
45 | 45 |
| |
| 46 | + | |
| 47 | + | |
46 | 48 |
| |
47 | 49 |
| |
48 | 50 |
| |
| |||
108 | 110 |
| |
109 | 111 |
| |
110 | 112 |
| |
| 113 | + | |
| 114 | + | |
111 | 115 |
| |
112 | 116 |
| |
113 | 117 |
| |
| |||
151 | 155 |
| |
152 | 156 |
| |
153 | 157 |
| |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + |
Lines changed: 36 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
346 | 346 |
| |
347 | 347 |
| |
348 | 348 |
| |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + |
0 commit comments
Comments
(0)