pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: fabiogibon@gmail.com
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #16048: SQLSTATE 22P05 is not captured in exception clause
Date: Fri, 11 Oct 2019 10:19:20 -0400
Message-ID: <16177.1570803560@sss.pgh.pa.us> (raw)
In-Reply-To: <16048-ff86833b63f1a0a2@postgresql.org>
References: <16048-ff86833b63f1a0a2@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





view thread (2+ messages)

Message-ID: <16177.1570803560@sss.pgh.pa.us>
Permalink:  ../16177.1570803560@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/16177.1570803560@sss.pgh.pa.us

 · 

reply

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: tgl@sss.pgh.pa.us, fabiogibon@gmail.com
  Subject: Re: BUG #16048: SQLSTATE 22P05 is not captured in exception clause
  In-Reply-To: <16177.1570803560@sss.pgh.pa.us>
  References: <16048-ff86833b63f1a0a2@postgresql.org> <16177.1570803560@sss.pgh.pa.us>

* 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