pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Paquier <michael@paquier.xyz>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Add safeguards in LSN, numeric and float calculation for custom
Date: Mon, 05 Aug 2019 06:36:11 +0000
Message-ID: <E1huWbL-00039x-Mx@gemulon.postgresql.org> (raw)

Add safeguards in LSN, numeric and float calculation for custom errors

Those data types use parsing and/or calculation wrapper routines which
can generate some generic error messages in the event of a failure.  The
caller of these routines can also pass a pointer variable settable by
the routine to track if an error has happened, letting the caller decide
what to do in the event of an error and what error message to generate.

Those routines have been slacking the initialization of the tracking
flag, which can be confusing when reading the code, so add some
safeguards against calls of these parsing routines which could lead to a
dubious result.

The LSN parsing gains an assertion to make sure that the tracking flag
is set, while numeric and float paths initialize the flag to a saner
state.

Author: Jeevan Ladhe
Reviewed-by: Álvaro Herrera, Michael Paquier
Discussion: https://postgr.es/m/CAOgcT0NOM9oR0Hag_3VpyW0uF3iCU=BDUFSPfk9JrWXRcWQHqw@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/a76cfba663ceab79b891cc81a5f941051755b3b0

Modified Files
--------------
src/backend/utils/adt/float.c   | 20 +++++++++++++-------
src/backend/utils/adt/numeric.c | 12 ++++++++++++
src/backend/utils/adt/pg_lsn.c  |  3 +++
3 files changed, 28 insertions(+), 7 deletions(-)



Message-ID: <E1huWbL-00039x-Mx@gemulon.postgresql.org>
Permalink:  ../E1huWbL-00039x-Mx@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1huWbL-00039x-Mx@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: michael@paquier.xyz
  Subject: Re: pgsql: Add safeguards in LSN, numeric and float calculation for custom
  In-Reply-To: <E1huWbL-00039x-Mx@gemulon.postgresql.org>
  References: <E1huWbL-00039x-Mx@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