pgsql: PG_FINALLY - Mailing list pgsql-committers

From Peter Eisentraut
Subject pgsql: PG_FINALLY
Date
Msg-id E1iQU8v-0006kn-09@gemulon.postgresql.org
Whole thread Raw
List 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(-)


pgsql-committers by date:

Previous
From: Peter Eisentraut
Date:
Subject: pgsql: Add const qualifiers to internal range type APIs
Next
From: Peter Eisentraut
Date:
Subject: pgsql: Add some assertions to view reloption macros