Hello, because I am not sure so any complex solution can be done to deadline for 9.1, I created a patch that is based on Tom ideas - just explicitly detoast function parameters.
Regards Pavel 2011/1/19 Robert Haas <robertmh...@gmail.com>: > On Wed, Jan 19, 2011 at 4:18 PM, Tom Lane <t...@sss.pgh.pa.us> wrote: >> One idea that I think we discussed was to tie cache entries to the >> memory context they were demanded in, and mark them unused at the next >> context reset/delete. That way they'd be considered unused at the same >> points where the current implementation would certainly have discarded >> the value. This isn't perfect (because of pfree) but might be good >> enough. > > Yeah, I was thinking that's probably what would have to be done. > > -- > Robert Haas > EnterpriseDB: http://www.enterprisedb.com > The Enterprise PostgreSQL Company >
*** ./src/pl/plpgsql/src/pl_exec.c.orig 2011-01-16 14:18:59.000000000 +0100 --- ./src/pl/plpgsql/src/pl_exec.c 2011-01-22 11:27:06.539626447 +0100 *************** *** 255,260 **** --- 255,273 ---- var->value = fcinfo->arg[i]; var->isnull = fcinfo->argnull[i]; var->freeval = false; + + /* Detoast call arguments early */ + if (!var->isnull && !var->datatype->typbyval && var->datatype->typlen == -1) + { + Datum value; + + value = PointerGetDatum(PG_DETOAST_DATUM(var->value)); + if (value != var->value) + { + var->value = value; + var->freeval = true; + } + } } break;
-- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers