| From: | Peter Eisentraut <peter(at)eisentraut(dot)org> |
|---|---|
| To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
| Subject: | pgsql: PG_FINALLY |
| Date: | 2019-11-01 10:26:56 |
| Message-ID: | E1iQU8v-0006kn-09@gemulon.postgresql.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-committers |
PG_FINALLY
This gives an alternative way of catching exceptions, for the common
case where the cleanup code is the same in the error and non-error
cases. So instead of
PG_TRY();
{
... code that might throw ereport(ERROR) ...
}
PG_CATCH();
{
cleanup();
PG_RE_THROW();
}
PG_END_TRY();
cleanup();
one can write
PG_TRY();
{
... code that might throw ereport(ERROR) ...
}
PG_FINALLY();
{
cleanup();
}
PG_END_TRY();
Discussion: https://www.postgresql.org/message-id/flat/95a822c3-728b-af0e-d7e5-71890507ae0c%402ndquadrant.com
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/604bd3671121b51f977de146ed95484c2297fb3e
Modified Files
--------------
contrib/auto_explain/auto_explain.c | 8 ++---
contrib/dblink/dblink.c | 19 ++--------
contrib/hstore_plpython/hstore_plpython.c | 5 +--
contrib/jsonb_plpython/jsonb_plpython.c | 5 +--
contrib/pg_stat_statements/pg_stat_statements.c | 12 ++-----
contrib/pg_trgm/trgm_regexp.c | 5 +--
contrib/postgres_fdw/connection.c | 5 +--
contrib/postgres_fdw/postgres_fdw.c | 25 +++-----------
contrib/sepgsql/hooks.c | 4 +--
contrib/sepgsql/label.c | 22 +++---------
contrib/sepgsql/selinux.c | 4 +--
contrib/sepgsql/uavc.c | 5 +--
src/backend/catalog/index.c | 8 ++---
src/backend/commands/async.c | 9 +----
src/backend/commands/copy.c | 4 +--
src/backend/commands/event_trigger.c | 10 ++----
src/backend/commands/extension.c | 6 +---
src/backend/commands/subscriptioncmds.c | 13 ++-----
src/backend/commands/trigger.c | 4 +--
src/backend/commands/vacuum.c | 6 +---
src/backend/libpq/be-fsstubs.c | 4 +--
src/backend/tcop/utility.c | 10 ++----
src/backend/utils/adt/xml.c | 20 +++--------
src/include/utils/elog.h | 46 ++++++++++++++++++++-----
src/pl/plperl/plperl.c | 16 ++-------
src/pl/plpgsql/src/pl_handler.c | 9 ++---
src/pl/plpython/plpy_cursorobject.c | 4 +--
src/pl/plpython/plpy_elog.c | 13 +------
src/pl/plpython/plpy_exec.c | 12 ++-----
src/pl/plpython/plpy_spi.c | 4 +--
src/pl/plpython/plpy_typeio.c | 5 +--
src/pl/tcl/pltcl.c | 14 ++------
32 files changed, 91 insertions(+), 245 deletions(-)
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Peter Eisentraut | 2019-11-01 12:29:39 | pgsql: Add some assertions to view reloption macros |
| Previous Message | Peter Eisentraut | 2019-10-31 06:49:10 | pgsql: Add const qualifiers to internal range type APIs |