Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Vl4K2-0003yE-Om for pgsql-bugs@arkaria.postgresql.org; Mon, 25 Nov 2013 22:08:02 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1Vl4K2-0007a2-7N for pgsql-bugs@arkaria.postgresql.org; Mon, 25 Nov 2013 22:08:02 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Vl4K1-0007Yz-61 for pgsql-bugs@postgresql.org; Mon, 25 Nov 2013 22:08:01 +0000 Received: from mimolette.dalibo.net ([212.85.154.222]) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Vl4Jy-0007o2-Mz for pgsql-bugs@postgresql.org; Mon, 25 Nov 2013 22:08:00 +0000 Received: from [192.168.0.38] (ip-68.net-81-220-133.standre.rev.numericable.fr [81.220.133.68]) by mimolette.dalibo.net (Postfix) with ESMTPSA id 35CBE682005E; Mon, 25 Nov 2013 23:07:25 +0100 (CET) Message-ID: <5293CA18.50105@dalibo.com> Date: Mon, 25 Nov 2013 23:07:20 +0100 From: Vik Fearing User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.1.0 MIME-Version: 1.0 To: Vincent Langard , pgsql-bugs@postgresql.org Subject: Re: BUG #8630: Planner behavior change between PG 9.0.14 and 9.3.1 References: In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org On 11/25/2013 04:56 PM, v.langard@auriga.fr wrote: > The following bug has been logged on the website: > > Bug reference: 8630 > Logged by: Vince > Email address: v.langard@auriga.fr > PostgreSQL version: 9.3.1 > Operating system: Windows 8 > Description: > > Using PG 9.0.14, this code returns no error: > > > create table t_dummy as ( > select > null::integer as int_value, > null::timestamp as ts_value > ); > > > create or replace function test(in_text character varying) > returns void as > $$ > begin > update t_dummy set > ts_value = in_text::timestamp, -- OK > int_value = in_text::integer -- ERROR > where false; > end; > $$ > language plpgsql volatile security definer; > > > select test('dummy'); > > > Using PG 9.3.1, the code returns error: invalid input syntax for integer: > "dummy" > > > It seems that the planner try to cast the dummy value, although update > should never be executed. "analyse" only raise error too, and there's no > error for timestamp casting. The change in behavior was caused by the following commit during the 9.2 cycle two years ago. Not sure what to do about it. commit e6ed34f70d57d102da8383919e0046c577d317e7 Author: Tom Lane Date: Fri Sep 16 12:31:23 2011 -0400 Ensure generic plan gets used for a plpgsql expression with no parameters. Now that a NULL ParamListInfo pointer causes significantly different behavior in plancache.c, be sure to pass it that way when the expression is known not to reference any plpgsql variables. Saves a few setup cycles anyway. -- Vik -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs