postgresql/src/backend
Tom Lane e23bae82cf Fix up run-time partition pruning's use of relcache's partition data.
The previous coding saved pointers into the partitioned table's relcache
entry, but then closed the relcache entry, causing those pointers to
nominally become dangling.  Actual trouble would be seen in the field
only if a relcache flush occurred mid-query, but that's hardly out of
the question.

While we could fix this by copying all the data in question at query
start, it seems better to just hold the relcache entry open for the
whole query.

While at it, improve the handling of support-function lookups: do that
once per query not once per pruning test.  There's still something to be
desired here, in that we fail to exploit the possibility of caching data
across queries in the fn_extra fields of the relcache's FmgrInfo structs,
which could happen if we just used those structs in-place rather than
copying them.  However, combining that with the possibility of per-query
lookups of cross-type comparison functions seems to require changes in the
APIs of a lot of the pruning support functions, so it's too invasive to
consider as part of this patch.  A win would ensue only for complex
partition key data types (e.g. arrays), so it may not be worth the
trouble.

David Rowley and Tom Lane

Discussion: https://postgr.es/m/17850.1528755844@sss.pgh.pa.us
2018-06-13 12:03:26 -04:00
..
access Fix function code in error report 2018-06-06 14:48:08 -04:00
bootstrap Message wording and pluralization improvements 2018-05-17 23:05:27 -04:00
catalog Fix spurious non-ASCII bytes 2018-06-04 16:17:34 -04:00
commands Fix access to just-closed relcache entry. 2018-06-11 19:18:04 -04:00
executor Fix up run-time partition pruning's use of relcache's partition data. 2018-06-13 12:03:26 -04:00
foreign Remove bogus "extern" annotations on function definitions. 2018-02-19 12:07:44 -05:00
jit Fix typo in JIT README. 2018-06-09 09:33:53 -07:00
lib Add missing files to src/backend/lib/README. 2018-05-22 13:25:28 +03:00
libpq Add missing serial commas 2018-06-07 23:37:09 -04:00
main Update copyright for 2018 2018-01-02 23:30:12 -05:00
nodes Assorted cosmetic cleanup of run-time-partition-pruning code. 2018-06-10 18:24:34 -04:00
optimizer Improve commentary about run-time partition pruning data structures. 2018-06-11 17:35:53 -04:00
parser Don't fall off the end of perl functions 2018-05-27 09:08:42 -04:00
partitioning Fix up run-time partition pruning's use of relcache's partition data. 2018-06-13 12:03:26 -04:00
po Translation updates 2018-05-21 12:29:52 -04:00
port Remove investigative code for can't-reattach-to-shared-memory errors. 2018-05-01 13:06:31 -04:00
postmaster Further improve code for probing the availability of ARM CRC instructions. 2018-05-03 11:32:57 -04:00
regex Clean up warnings from -Wimplicit-fallthrough. 2018-05-01 19:35:08 -04:00
replication Convert debug message from ereport to elog 2018-06-12 11:33:39 -04:00
rewrite Simplify view-expansion code in rewriteHandler.c. 2018-04-14 21:01:03 -04:00
snowball Avoid unnecessary use of pg_strcasecmp for already-downcased identifiers. 2018-01-26 18:25:14 -05:00
statistics Fix bogus code for extracting extended-statistics data from syscache. 2018-05-02 12:23:00 -04:00
storage Exclude VACUUMs from RunningXactData 2018-06-07 20:38:12 +01:00
tcop Don't allow partitioned index on foreign-table partitions 2018-05-14 13:23:07 -04:00
tsearch Post-feature-freeze pgindent run. 2018-04-26 14:47:16 -04:00
utils Fix up run-time partition pruning's use of relcache's partition data. 2018-06-13 12:03:26 -04:00
.gitignore Add .gitignore entries for AIX-specific intermediate build artifacts. 2015-07-08 20:44:22 -04:00
Makefile Rearrange makefile rules for running Gen_fmgrtab.pl. 2018-05-03 17:54:18 -04:00
common.mk Remove PARTIAL_LINKING build mode. 2018-03-30 17:33:04 -07:00
nls.mk Translation updates 2017-05-15 12:19:54 -04:00