Undocumented optionality of handler_statements

From: PG Doc comments form <noreply(at)postgresql(dot)org>
To: pgsql-docs(at)lists(dot)postgresql(dot)org
Cc: philipp(dot)salvisberg(at)gmail(dot)com
Subject: Undocumented optionality of handler_statements
Date: 2024-07-22 13:55:52
Message-ID: 172165655256.710.2097726158572647813@wrigleys.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs

The following documentation comment has been logged on the website:

Page: https://www.postgresql.org/docs/16/plpgsql-control-structures.html
Description:

In
https://www.postgresql.org/docs/16/plpgsql-control-structures.html#PLPGSQL-ERROR-TRAPPING
handler_statements are documented as optional.

However, the following example shows that handler_statements can be omitted.

drop table if exists t;
create table t (id integer not null primary key);
do $$
begin
insert into t (id) values (1), (1);
exception when unique_violation then
-- ignore without calling null statement
end
$$;

I stumbled over it when running the example documented in
https://www.postgresql.org/docs/current/plpgsql-trigger.html#PLPGSQL-TRIGGER-SUMMARY-EXAMPLE
- it also contains an exception handler without handler statements.

Responses

Browse pgsql-docs by date

  From Date Subject
Next Message Philipp Salvisberg 2024-07-22 14:01:18 Re: Undocumented := alternative in using option of raise statement
Previous Message jian he 2024-07-22 13:18:41 Re: Undocumented := alternative in using option of raise statement