| From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
|---|---|
| To: | Ц <pfunk(at)mail(dot)ru> |
| Cc: | pgsql-general <pgsql-general(at)lists(dot)postgresql(dot)org> |
| Subject: | Re: SQL state: 42601. Execption handling. |
| Date: | 2022-06-07 14:36:52 |
| Message-ID: | 1100021.1654612612@sss.pgh.pa.us |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
=?UTF-8?B?0KY=?= <pfunk(at)mail(dot)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
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Merlin Moncure | 2022-06-07 15:09:02 | Re: '{"x": 42, "y": null}'::jsonb != '{"x": 42}'::jsonb ... Really? |
| Previous Message | Ц | 2022-06-07 14:19:02 | SQL state: 42601. Execption handling. |