postgresql/src/backend/utils/cache
Tom Lane ec7eef6b11 Avoid caching expression state trees for domain constraints across queries.
In commit 8abb3cda0d I attempted to cache
the expression state trees constructed for domain CHECK constraints for
the life of the backend (assuming the domain's constraints don't get
redefined).  However, this turns out not to work very well, because
execQual.c will run those state trees with ecxt_per_query_memory pointing
to a query-lifespan context, and in some situations we'll end up with
pointers into that context getting stored into the state trees.  This
happens in particular with SQL-language functions, as reported by
Emre Hasegeli, but there are many other cases.

To fix, keep only the expression plan trees for domain CHECK constraints
in the typcache's data structure, and revert to performing ExecInitExpr
(at least) once per query to set up expression state trees in the query's
context.

Eventually it'd be nice to undo this, but that will require some careful
thought about memory management for expression state trees, and it seems
far too late for any such redesign in 9.5.  This way is still much more
efficient than what happened before 8abb3cda0.
2015-11-29 18:18:42 -05:00
..
Makefile Add infrastructure for mapping relfilenodes to relation OIDs. 2013-07-22 11:09:10 -04:00
attoptcache.c Update copyright for 2015 2015-01-06 11:43:47 -05:00
catcache.c Collection of typo fixes. 2015-05-20 16:56:22 +03:00
evtcache.c Update copyright for 2015 2015-01-06 11:43:47 -05:00
inval.c Fix the logic for putting relations into the relcache init file. 2015-06-25 14:39:05 -04:00
lsyscache.c Generate parallel sequential scan plans in simple cases. 2015-11-11 09:02:52 -05:00
plancache.c Remove the SECURITY_ROW_LEVEL_DISABLED security context bit. 2015-09-20 20:47:17 -04:00
relcache.c Be more noisy about "wrong number of nailed relations" initfile problems. 2015-11-11 13:39:21 -05:00
relfilenodemap.c Update copyright for 2015 2015-01-06 11:43:47 -05:00
relmapper.c Reorganize our CRC source files again. 2015-04-14 17:03:42 +03:00
spccache.c Allow per-tablespace effective_io_concurrency 2015-09-08 12:51:42 -03:00
syscache.c Redesign tablesample method API, and do extensive code review. 2015-07-25 14:39:00 -04:00
ts_cache.c Update copyright for 2015 2015-01-06 11:43:47 -05:00
typcache.c Avoid caching expression state trees for domain constraints across queries. 2015-11-29 18:18:42 -05:00