Received: from magus.postgresql.org (magus.postgresql.org [87.238.57.229]) by mail.postgresql.org (Postfix) with ESMTP id E708A2EBA7A for ; Thu, 24 Nov 2011 11:16:13 -0400 (AST) Received: from exprod7og118.obsmtp.com ([64.18.2.8]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1RTb20-00074Z-BB for pgsql-hackers@postgresql.org; Thu, 24 Nov 2011 15:16:10 +0000 Received: from mail-bw0-f53.google.com ([209.85.214.53]) (using TLSv1) by exprod7ob118.postini.com ([64.18.6.12]) with SMTP ID DSNKTs5fqSrIea01fmgiGDrh2DS7o3YChvM4@postini.com; Thu, 24 Nov 2011 07:16:08 PST Received: by bkaq10 with SMTP id q10so3676462bka.40 for ; Thu, 24 Nov 2011 07:15:52 -0800 (PST) Received: by 10.205.120.20 with SMTP id fw20mr30179740bkc.39.1322147752262; Thu, 24 Nov 2011 07:15:52 -0800 (PST) Received: from [192.168.1.100] (dsl-hkibrasgw2-ff6cc300-200.dhcp.inet.fi. [88.195.108.200]) by mx.google.com with ESMTPS id b2sm1101454fao.1.2011.11.24.07.15.50 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 24 Nov 2011 07:15:51 -0800 (PST) Message-ID: <4ECE5FA5.6060506@enterprisedb.com> Date: Thu, 24 Nov 2011 17:15:49 +0200 From: Heikki Linnakangas User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; fi-FI; rv:1.9.2.23) Gecko/20111010 Icedove/3.1.15 MIME-Version: 1.0 To: =?UTF-8?B?SmFuIFVyYmHFhHNraQ==?= CC: Mika Eloranta , pgsql-hackers@postgresql.org Subject: Re: PL/Python SQL error code pass-through References: <0174B71F-7940-4819-BDC8-95EC8C9BA833@ohmu.fi> <4ECDFB26.1090203@wulczer.org> In-Reply-To: <4ECDFB26.1090203@wulczer.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Archive-Number: 201111/1434 X-Sequence-Number: 198919 On 24.11.2011 10:07, Jan UrbaƄski wrote: > On 23/11/11 17:24, Mika Eloranta wrote: >> Hi all, >> >> [PL/Python in 9.1 does not preserve SQLSTATE of errors] > > Oops, you're right, it's a regression from 9.0 behaviour. > > The fix looks good to me, I changed one place to indent with tabs > instead of spaces and added a regression test. Thank you, both. Is there some other fields that we should propagate from the original error message that we're missing? Like, context and file/line information? Or are those left out on purpose? I wonder if we should have a more wholesale approach, and store the whole ErrorData struct somewhere, and only add some extra context information with errcontext(). > I think this should be backpatched to 9.1, no? Yeah, it should. Your patch probably makes most sense for backpatching, even if we do something more radical on master. -- Heikki Linnakangas EnterpriseDB http://www.enterprisedb.com