postgresql/src/backend/utils/cache
Tom Lane 967a7b0fc9 Avoid reporting "cache lookup failed" for some user-reachable cases.
We have a not-terribly-thoroughly-enforced-yet project policy that internal
errors with SQLSTATE XX000 (ie, plain elog) should not be triggerable from
SQL.  record_in, domain_in, and PL validator functions all failed to meet
this standard, because they threw plain elog("cache lookup failed for XXX")
errors on bad OIDs, and those are all invokable from SQL.

For record_in, the best fix is to upgrade typcache.c (lookup_type_cache)
to throw a user-facing error for this case.  That seems consistent because
it was more than halfway there already, having user-facing errors for shell
types and non-composite types.  Having done that, tweak domain_in to rely
on the typcache to throw an appropriate error.  (This costs little because
InitDomainConstraintRef would fetch the typcache entry anyway.)

For the PL validator functions, we already have a single choke point at
CheckFunctionValidatorAccess, so just fix its error to be user-facing.

Dilip Kumar, reviewed by Haribabu Kommi

Discussion: <87wpxfygg9.fsf@credativ.de>
2016-09-09 09:20:34 -04:00
..
Makefile Add infrastructure for mapping relfilenodes to relation OIDs. 2013-07-22 11:09:10 -04:00
attoptcache.c Update copyright for 2016 2016-01-02 13:33:40 -05:00
catcache.c Add macros to make AllocSetContextCreate() calls simpler and safer. 2016-08-27 17:50:38 -04:00
evtcache.c Add macros to make AllocSetContextCreate() calls simpler and safer. 2016-08-27 17:50:38 -04:00
inval.c Emit invalidations to standby for transactions without xid. 2016-04-26 20:21:54 -07:00
lsyscache.c pgindent run for 9.6 2016-06-09 18:02:36 -04:00
plancache.c Add macros to make AllocSetContextCreate() calls simpler and safer. 2016-08-27 17:50:38 -04:00
relcache.c Add macros to make AllocSetContextCreate() calls simpler and safer. 2016-08-27 17:50:38 -04:00
relfilenodemap.c Update copyright for 2016 2016-01-02 13:33:40 -05:00
relmapper.c Update copyright for 2016 2016-01-02 13:33:40 -05:00
spccache.c Update copyright for 2016 2016-01-02 13:33:40 -05:00
syscache.c Restructure index access method API to hide most of it at the C level. 2016-01-17 19:36:59 -05:00
ts_cache.c Add macros to make AllocSetContextCreate() calls simpler and safer. 2016-08-27 17:50:38 -04:00
typcache.c Avoid reporting "cache lookup failed" for some user-reachable cases. 2016-09-09 09:20:34 -04:00