pgsql: Fix SQL function execution to be safe with long-lived FmgrInfos.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Fix SQL function execution to be safe with long-lived FmgrInfos.
Date: 2013-03-03 22:40:22
Message-ID: E1UCHZu-0002Tz-VM@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix SQL function execution to be safe with long-lived FmgrInfos.

fmgr_sql had been designed on the assumption that the FmgrInfo it's called
with has only query lifespan. This is demonstrably unsafe in connection
with range types, as shown in bug #7881 from Andrew Gierth. Fix things
so that we re-generate the function's cache data if the (sub)transaction
it was made in is no longer active.

Back-patch to 9.2. This might be needed further back, but it's not clear
whether the case can realistically arise without range types, so for now
I'll desist from back-patching further.

Branch
------
REL9_2_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/d4f4bdf23a47dc2b6122195bbff4b09c80e7e2f5

Modified Files
--------------
src/backend/access/transam/xact.c | 21 +++++++++
src/backend/executor/functions.c | 88 ++++++++++++++++++++++++++++++++-----
src/include/access/xact.h | 1 +
3 files changed, 98 insertions(+), 12 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Greg Stark 2013-03-03 22:47:50 Re: Materialized views WIP patch
Previous Message Kevin Grittner 2013-03-03 21:06:56 Re: Materialized views WIP patch