diff options
author | Alvaro Herrera <alvherre@alvh.no-ip.org> | 2016-12-09 12:42:17 -0300 |
---|---|---|
committer | Alvaro Herrera <alvherre@alvh.no-ip.org> | 2016-12-09 12:42:17 -0300 |
commit | 581b09c72524db9a141a1b9217f01cf2b24ae512 (patch) | |
tree | bb1fd086ccd401e4db14f6c663f2edf3af8d962e /src/tutorial/complex.c | |
parent | 141ad68964f739c6543dc48143829c2cd0dd0c86 (diff) | |
download | postgresql-581b09c72524db9a141a1b9217f01cf2b24ae512.tar.gz postgresql-581b09c72524db9a141a1b9217f01cf2b24ae512.zip |
Fix crasher bug in array_position(s)
array_position and its cousin array_positions were caching the element
type equality function's FmgrInfo without being careful enough to put it
in a long-lived context. This is obviously broken but it didn't matter
in most cases; only when using arrays of records (involving record_eq)
it becomes a problem. The fix is to ensure that the type's equality
function's FmgrInfo is cached in the array_position's flinfo->fn_mcxt
rather than the current memory context.
Apart from record types, the only other case that seems complex enough
to possibly cause the same problem are range types. I didn't find a way
to reproduce the problem with those, so I only include the test case
submitted with the bug report as regression test.
Bug report and patch: Junseok Yang
Discussion: https://postgr.es/m/CAE+byMupUURYiZ6bKYgMZb9pgV1CYAijJGqWj-90W=nS7uEOeA@mail.gmail.com
Backpatch to 9.5, where array_position appeared.
Diffstat (limited to 'src/tutorial/complex.c')
0 files changed, 0 insertions, 0 deletions