pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Peter Eisentraut <peter@eisentraut.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: PG_FINALLY
Date: Fri, 01 Nov 2019 10:26:56 +0000
Message-ID: <E1iQU8v-0006kn-09@gemulon.postgresql.org> (raw)

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(-)



Message-ID: <E1iQU8v-0006kn-09@gemulon.postgresql.org>
Permalink:  ../E1iQU8v-0006kn-09@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1iQU8v-0006kn-09@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: peter@eisentraut.org
  Subject: Re: pgsql: PG_FINALLY
  In-Reply-To: <E1iQU8v-0006kn-09@gemulon.postgresql.org>
  References: <E1iQU8v-0006kn-09@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox