pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix portability issues in datetime parsing.
Date: Sun, 03 Apr 2022 21:04:50 +0000
Message-ID: <E1nb7P0-000BSa-7S@gemulon.postgresql.org> (raw)

Fix portability issues in datetime parsing.

datetime.c's parsing logic has assumed that strtod() will accept
a string that looks like ".", which it does in glibc, but not on
some less-common platforms such as AIX.  The result of this was
that datetime fields like "123." would be accepted on some platforms
but not others; which is a sufficiently odd case that it's not that
surprising we've heard no field complaints.  But commit e39f99046
extended that assumption to new places, and happened to add a test
case that exposed the platform dependency.  Remove this dependency
by special-casing situations without any digits after the decimal
point.

(Again, this is in part a pre-existing bug but I don't feel a
compulsion to back-patch.)

Also, rearrange e39f99046's changes in formatting.c to avoid a
Coverity complaint that we were copying an uninitialized field.

Discussion: https://postgr.es/m/1592893.1648969747@sss.pgh.pa.us

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/591e088dd5b357796e136c13dfcdb1f06fd7a3c2

Modified Files
--------------
src/backend/utils/adt/datetime.c       | 105 ++++++++++++++++++++++++---------
src/backend/utils/adt/formatting.c     |  20 ++++---
src/test/regress/expected/interval.out |  35 +++++++++++
src/test/regress/sql/interval.sql      |   8 +++
4 files changed, 132 insertions(+), 36 deletions(-)



Message-ID: <E1nb7P0-000BSa-7S@gemulon.postgresql.org>
Permalink:  ../E1nb7P0-000BSa-7S@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1nb7P0-000BSa-7S@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: tgl@sss.pgh.pa.us
  Subject: Re: pgsql: Fix portability issues in datetime parsing.
  In-Reply-To: <E1nb7P0-000BSa-7S@gemulon.postgresql.org>
  References: <E1nb7P0-000BSa-7S@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