From: steve@empiricalthought.com
To: pgsql-bugs@postgresql.org
Subject: BUG #6646: PL/Python spiexceptions raised inside Python do not include sqlstate in external code
Date: Wed, 16 May 2012 18:49:46 +0000
Message-ID: <E1SUjIA-0002FA-Bi@wrigleys.postgresql.org> (raw)
The following bug has been logged on the website:
Bug reference: 6646
Logged by: Steven Huwig
Email address: steve@empiricalthought.com
PostgreSQL version: 9.1.3
Operating system: Linux
Description:
I am trying to raise standard SQL errors from inside PL/Python code.
However, they do not work as expected. They always have sqlstate = XX000
instead of the appropriate sqlstate value.
create function python_exception_bug()
returns void as $$
raise plpy.spiexceptions.InvalidParameterValue()
$$ language 'plpython3u';
create function python_exception_sql()
returns text as $$
begin
select python_exception_bug();
return 'cannot happen';
exception when invalid_parameter_value then
return 'expected behavior';
when others then
return 'this is a bug';
end
$$ language 'plpgsql';
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: steve@empiricalthought.com
Subject: Re: BUG #6646: PL/Python spiexceptions raised inside Python do not include sqlstate in external code
In-Reply-To: <E1SUjIA-0002FA-Bi@wrigleys.postgresql.org>
References: <E1SUjIA-0002FA-Bi@wrigleys.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox