postgresql/src
Alvaro Herrera 79c89f1f4e 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.
2016-12-09 12:42:17 -03:00
..
backend Fix crasher bug in array_position(s) 2016-12-09 12:42:17 -03:00
bin Fix busted tab-completion pattern for ALTER TABLE t ALTER c DROP ... 2016-11-28 11:51:35 -05:00
common pgindent run for 9.6 2016-06-09 18:02:36 -04:00
fe_utils Restore psql's SIGPIPE setting if popen() fails. 2016-12-07 12:39:24 -05:00
include Revert "Permit dump/reload of not-too-large >1GB tuples" 2016-12-06 12:46:03 -03:00
interfaces Handle empty or all-blank PAGER setting more sanely in psql. 2016-12-07 12:19:56 -05:00
makefiles Fix typos in comments and doc 2016-01-28 16:47:36 +09:00
pl Rationalize and document pltcl's handling of magic ".tupno" array element. 2016-11-06 14:43:13 -05:00
port Make pgwin32_putenv() visit debug CRTs. 2016-12-03 15:46:42 -05:00
template Remove some remains from Alpha support removal 2015-10-29 16:40:14 -04:00
test Fix crasher bug in array_position(s) 2016-12-09 12:42:17 -03:00
timezone More zic cleanup. 2016-11-06 10:46:08 -05:00
tools Change qr/foo$/m to qr/foo\n/m, for Perl 5.8.8. 2016-11-07 20:27:35 -05:00
tutorial Update copyright for 2016 2016-01-02 13:33:40 -05:00
.gitignore Convert cvsignore to gitignore, and add .gitignore for build targets. 2010-09-22 12:57:04 +02:00
bcc32.mak Autoconfiscate selection of 64-bit int type for 64-bit large object API. 2012-10-07 21:52:43 -04:00
DEVELOPERS Replace a couple of references to files that no longer exist in the source 2009-05-04 08:08:47 +00:00
Makefile Install TAP test infrastructure so it's available for extension testing. 2016-09-23 15:50:00 -04:00
Makefile.global.in Make TAP test suites to work, when @INC does not contain current dir. 2016-10-07 22:01:04 +03:00
Makefile.shlib Fix misstatement in comment in Makefile.shlib. 2016-10-01 13:45:23 -04:00
nls-global.mk nls-global.mk: search build dir for source files, too 2016-06-07 18:55:18 -04:00
win32.mak Autoconfiscate selection of 64-bit int type for 64-bit large object API. 2012-10-07 21:52:43 -04:00