| From: | PG Bug reporting form <noreply(at)postgresql(dot)org> |
|---|---|
| To: | pgsql-bugs(at)lists(dot)postgresql(dot)org |
| Cc: | jacobcrell(at)gmail(dot)com |
| Subject: | BUG #16405: Exception P0004 not caught in EXCEPTION WHEN OTHERS |
| Date: | 2020-04-30 16:07:35 |
| Message-ID: | 16405-b2ea8017cd288002@postgresql.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-bugs |
The following bug has been logged on the website:
Bug reference: 16405
Logged by: Jacob Crell
Email address: jacobcrell(at)gmail(dot)com
PostgreSQL version: 10.0
Operating system: AWS Aurora
Description:
Create below function to return assertion failue:
CREATE OR REPLACE FUNCTION assert_fail()
RETURNS void
LANGUAGE plpgsql
AS $function$
BEGIN
ASSERT FALSE, 'Assertion Failed';
END;
$function$;
Create this function to call above function and catch error:
CREATE OR REPLACE FUNCTION catch_assert_fail()
RETURNS text
LANGUAGE plpgsql
AS $function$
BEGIN
SELECT * FROM meta.assert_fail();
RETURN 'Function Finished';
EXCEPTION WHEN OTHERS THEN
RETURN 'Hit the Other exception block';
END;
$function$;
Run below to call function
SELECT * FROM catch_assert_fail()
Excepted Behavior: P0004 exception is caught in EXCEPTION WHEN OTHERS,
function returns text 'Hit the Other exception block'.
Actual Behavior: P0004 exception is raised and remains uncaught.
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Alex Movitz | 2020-04-30 16:58:27 | Re: BUG #16403: set_bit function does not have expected effect |
| Previous Message | 断桥烟雨三两月 | 2020-04-30 15:45:11 | 回复: report bug |