Avoid an Assert failure in deconstruct_array() by making get_attstatsslot()

Tom Lane <tgl@sss.pgh.pa.us>

Commit: dae11908e8dfa72f87d6f3af3c9c2c29dadefcd4
Author: Tom Lane <tgl@sss.pgh.pa.us>
Date: 2010-07-09T22:58:12Z
Releases: 8.1.22
Avoid an Assert failure in deconstruct_array() by making get_attstatsslot()
use the actual element type of the array it's disassembling, rather than
trusting the type OID passed in by its caller.  This is needed because
sometimes the planner passes in a type OID that's only binary-compatible
with the target column's type, rather than being an exact match.  Per an
example from Bernd Helmle.

Possibly we should refactor get_attstatsslot/free_attstatsslot to not expect
the caller to supply type ID data at all, but for now I'll just do the
minimum-change fix.

Back-patch to 7.4.  Bernd's test case only crashes back to 8.0, but since
these subroutines are the same in 7.4, I suspect there may be variant
cases that would crash 7.4 as well.

Files

PathChange+/−
src/backend/utils/cache/lsyscache.c modified +17 −5