Re: Nested CASE-WHEN scoping
Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>
From: Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2011-05-25T17:27:02Z
Lists: pgsql-hackers
On 25.05.2011 20:11, Tom Lane wrote: > Heikki Linnakangas<heikki.linnakangas@enterprisedb.com> writes: >> On 25.05.2011 17:47, Tom Lane wrote: >>> [ scratches head ... ] Why does the save/restore in ExecEvalCase not >>> take care of this? > >> The mistake happens during planning, when the SQL function is inlined >> and pre-evaluated. > > Hm. I'm inclined to think this may be more of a bug in the inlining > process than anything else. Well, if you want to get away without the capability to reference multiple CaseTestExprs at a time, you'll have to detect the danger and abort the inlining process. That's a bit pessimal, although this is a pretty artificial case in the first place so maybe we don't care much. (I'm still going to need more placeholder slots to handle IN and BETWEEN. Of course, I can just copy-paste CaseTestExpr into something like InTestExpr and BetweenTestExpr, but it seems like it would be good to unite all that infrastructure) -- Heikki Linnakangas EnterpriseDB http://www.enterprisedb.com