Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id D738AB5DD56 for ; Mon, 30 May 2011 15:34:37 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 53685-01-4 for ; Mon, 30 May 2011 18:34:31 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by mail.postgresql.org (Postfix) with ESMTP id 44791B5DDB4 for ; Mon, 30 May 2011 15:32:03 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id p4UELUjp023056; Mon, 30 May 2011 10:21:31 -0400 (EDT) To: Heikki Linnakangas cc: PostgreSQL-development Subject: Re: Nested CASE-WHEN scoping In-reply-to: <4DE38CCD.80702@enterprisedb.com> References: <4DDCEEB8.50602@enterprisedb.com> <5487.1306334876@sss.pgh.pa.us> <4DDD35B6.2050203@enterprisedb.com> <27772.1306359110@sss.pgh.pa.us> <4DE38CCD.80702@enterprisedb.com> Comments: In-reply-to Heikki Linnakangas message dated "Mon, 30 May 2011 15:25:49 +0300" Date: Mon, 30 May 2011 10:21:30 -0400 Message-ID: <23055.1306765290@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.91 tagged_above=-5 required=5 tests=BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201105/1512 X-Sequence-Number: 188546 Heikki Linnakangas writes: > I think we can work around both of those by just saving and restoring > the value of each Param that we set while evaluating an expression, Huh? That's a waste of time and effort. Just make sure that each such spot has its own Param number. That's why I'm telling you to do it in the planner, not the parser --- it is easy to assign globally-unique- across-the-plan numbers at plan time, in fact we do it already. > For debugging purposes, it seems like a good idea to invent a new kind > of Param for these, and keep them separate from PARAM_EXEC params. I'd vote against that too. PARAM_EXEC Params already have more than one purpose. regards, tom lane