pg.ddx.io pgsql-bugs@postgresql.org mailing list archive
help / color / mirror / Atom feedBUG #16048: SQLSTATE 22P05 is not captured in exception clause
2+ messages / 2 participants
[nested] [flat]
* BUG #16048: SQLSTATE 22P05 is not captured in exception clause
@ 2019-10-11 14:03 PG Bug reporting form <noreply@postgresql.org>
0 siblings, 1 reply; 2+ messages in thread
From: PG Bug reporting form @ 2019-10-11 14:03 UTC (permalink / raw)
To: pgsql-bugs@lists.postgresql.org; +Cc: fabiogibon@gmail.com
The following bug has been logged on the website:
Bug reference: 16048
Logged by: Fabio Henrique Gibon
Email address: fabiogibon@gmail.com
PostgreSQL version: 12.0
Operating system: Windows
Description:
Hi,
I have a database using LATIN1 (and I can't change it), so, when the
user informar a invalid character it is not captured in exception clause.
See a short sample:
DO $$
DECLARE
v varchar;
BEGIN
v := 'ABCŸ';
EXCEPTION
WHEN others THEN
RAISE INFO 'Error State: %', SQLSTATE;
END$$;
I tried in old versions (9.0, 9.6,...) and the result is the same. The error
is propagated, disregarding the exception treatement.
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: BUG #16048: SQLSTATE 22P05 is not captured in exception clause
@ 2019-10-11 14:19 Tom Lane <tgl@sss.pgh.pa.us>
parent: PG Bug reporting form <noreply@postgresql.org>
0 siblings, 0 replies; 2+ messages in thread
From: Tom Lane @ 2019-10-11 14:19 UTC (permalink / raw)
To: fabiogibon@gmail.com; +Cc: pgsql-bugs@lists.postgresql.org
PG Bug reporting form <noreply@postgresql.org> writes:
> I have a database using LATIN1 (and I can't change it), so, when the
> user informar a invalid character it is not captured in exception clause.
> See a short sample:
> DO $$
> DECLARE
> v varchar;
> BEGIN
> v := 'ABCŸ';
> EXCEPTION
> WHEN others THEN
> RAISE INFO 'Error State: %', SQLSTATE;
> END$$;
Sorry, that's not a bug, and you're going to have to find some other
way to deal with the issue. This error will be thrown while trying to
convert the incoming query string to the database encoding, long before
anything in the server would be able to recognize that this even is a
DO command, let alone is one containing an exception clause.
Exception clauses don't work for syntax errors either, for largely
similar reasons.
regards, tom lane
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2019-10-11 14:19 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2019-10-11 14:03 BUG #16048: SQLSTATE 22P05 is not captured in exception clause PG Bug reporting form <noreply@postgresql.org>
2019-10-11 14:19 ` Tom Lane <tgl@sss.pgh.pa.us>
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