forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commita73491e
committed
Fix crasher bug in array_position(s)
array_position and its cousin array_positions were caching the elementtype equality function's FmgrInfo without being careful enough to put itin a long-lived context. This is obviously broken but it didn't matterin most cases; only when using arrays of records (involving record_eq)it becomes a problem. The fix is to ensure that the type's equalityfunction's FmgrInfo is cached in the array_position's flinfo->fn_mcxtrather than the current memory context.Apart from record types, the only other case that seems complex enoughto possibly cause the same problem are range types. I didn't find a wayto reproduce the problem with those, so I only include the test casesubmitted with the bug report as regression test.Bug report and patch: Junseok YangDiscussion:https://postgr.es/m/CAE+byMupUURYiZ6bKYgMZb9pgV1CYAijJGqWj-90W=nS7uEOeA@mail.gmail.comBackpatch to 9.5, where array_position appeared.1 parent64bc26f commita73491e
File tree
3 files changed
+27
-2
lines changed- src
- backend/utils/adt
- test/regress
- expected
- sql
3 files changed
+27
-2
lines changedLines changed: 4 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
795 | 795 |
| |
796 | 796 |
| |
797 | 797 |
| |
798 |
| - | |
| 798 | + | |
| 799 | + | |
799 | 800 |
| |
800 | 801 |
| |
801 | 802 |
| |
| |||
933 | 934 |
| |
934 | 935 |
| |
935 | 936 |
| |
936 |
| - | |
| 937 | + | |
| 938 | + | |
937 | 939 |
| |
938 | 940 |
| |
939 | 941 |
| |
|
Lines changed: 14 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
589 | 589 |
| |
590 | 590 |
| |
591 | 591 |
| |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
592 | 606 |
| |
593 | 607 |
| |
594 | 608 |
| |
|
Lines changed: 9 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
262 | 262 |
| |
263 | 263 |
| |
264 | 264 |
| |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
265 | 274 |
| |
266 | 275 |
| |
267 | 276 |
| |
|
0 commit comments
Comments
(0)