From: Tom Lane <tgl@sss.pgh.pa.us>
To: Ц <pfunk@mail.ru>
Cc: pgsql-general <pgsql-general@lists.postgresql.org>
Subject: Re: SQL state: 42601. Execption handling.
Date: Tue, 07 Jun 2022 10:36:52 -0400
Message-ID: <1100021.1654612612@sss.pgh.pa.us> (raw)
In-Reply-To: <1654611542.501794552@f527.i.mail.ru>
References: <1654611542.501794552@f527.i.mail.ru>
=?UTF-8?B?0KY=?= <pfunk@mail.ru> writes:
> -- 2 --
> do $$
> begin
> select p.result from dbo.func() p into v_result;
> exception when SQLSTATE '42601' then
> raise '42601' ;
> when others then
> raise 'others' ;
> end ;
> $$
>
> --Exception is not handled. This is the question.
> ERROR: "v_result" is not a known variable
> LINE 3 : select p.result from dbo.func() p into v_result;
This error is thrown by the plpgsql parser, so you can't trap it
with "exception", any more than you could trap other syntax errors
detected by the parser. (As an extreme example, you could certainly
not trap it if you misspelled "exception".)
regards, tom lane
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-general@postgresql.org
Cc: tgl@sss.pgh.pa.us, pfunk@mail.ru
Subject: Re: SQL state: 42601. Execption handling.
In-Reply-To: <1100021.1654612612@sss.pgh.pa.us>
References: <1654611542.501794552@f527.i.mail.ru> <1100021.1654612612@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