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: Fix precision handling for some COERCE_SQL_SYNTAX functions
Date: Fri, 30 Dec 2022 11:49:06 +0000
Message-ID: <E1pBDso-0018aX-6W@gemulon.postgresql.org> (raw)

Fix precision handling for some COERCE_SQL_SYNTAX functions

f193883 has been incorrectly setting up the precision used in the
timestamp compilations returned by the following functions:
- LOCALTIME
- LOCALTIMESTAMP
- CURRENT_TIME
- CURRENT_TIMESTAMP

Specifying an out-of-range precision for CURRENT_TIMESTAMP and
LOCALTIMESTAMP was raising a WARNING without adjusting the precision,
leading to a subsequent error.  LOCALTIME and CURRENT_TIME raised a
WARNING without an error, still the precision given to the internal
routines was not correct, so let's be clean.

Ian has reported the problems in timestamp.c, while I have noticed the
ones in date.c.  Regression tests are added for all of them with
precisions high enough to provide coverage for the warnings, something
that went missing up to this commit.

Author: Ian Lawrence Barwick, Michael Paquier
Discussion: https://postgr.es/m/CAB8KJ=jQEnn9sYG+N752spt68wMrhmT-ocHCh4oeNmHF82QMWA@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/7aa81c61ec8f68212570192f3088544dbfa43cb9

Modified Files
--------------
src/backend/utils/adt/date.c              | 10 ++--------
src/backend/utils/adt/timestamp.c         | 10 ++--------
src/test/regress/expected/expressions.out | 31 ++++++++++++++++++++++++++++++-
src/test/regress/sql/expressions.sql      |  7 ++++++-
4 files changed, 40 insertions(+), 18 deletions(-)



Message-ID: <E1pBDso-0018aX-6W@gemulon.postgresql.org>
Permalink:  ../E1pBDso-0018aX-6W@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1pBDso-0018aX-6W@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: Fix precision handling for some COERCE_SQL_SYNTAX functions
  In-Reply-To: <E1pBDso-0018aX-6W@gemulon.postgresql.org>
  References: <E1pBDso-0018aX-6W@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