pgsql: Support for FF1-FF6 datetime format patterns

From: Alexander Korotkov <akorotkov(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Support for FF1-FF6 datetime format patterns
Date: 2019-09-16 18:16:46
Message-ID: E1i9vYM-0000Pb-WA@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Support for FF1-FF6 datetime format patterns

SQL Standard 2016 defines FF1-FF9 format patters for fractions of seconds in
jsonpath .datetime() method and CAST (... FORMAT ...) SQL clause. Parsing
engine of upcoming .datetime() method will be shared with to_date()/
to_timestamp().

This patch implements FF1-FF6 format patterns for upcoming jsonpath .datetime()
method. to_date()/to_timestamp() functions will also get support of this
format patterns as positive side effect. FF7-FF9 are not supported due to
lack of precision in our internal timestamp representation.

Extracted from original patch by Nikita Glukhov, Teodor Sigaev, Oleg Bartunov.
Heavily revised by me.

Discussion: https://postgr.es/m/fcc6fc6a-b497-f39a-923d-aa34d0c588e8%402ndQuadrant.com
Discussion: https://postgr.es/m/CAPpHfdsZgYEra_PeCLGNoXOWYx6iU-S3wF8aX0ObQUcZU%2B4XTw%40mail.gmail.com
Author: Nikita Glukhov, Teodor Sigaev, Oleg Bartunov, Alexander Korotkov
Reviewed-by: Anastasia Lubennikova, Peter Eisentraut

Branch
------
master

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

Modified Files
--------------
doc/src/sgml/func.sgml | 24 ++++++++
src/backend/utils/adt/formatting.c | 99 ++++++++++++++++++++++++-------
src/backend/utils/adt/timestamp.c | 3 +-
src/include/utils/datetime.h | 2 +
src/test/regress/expected/horology.out | 79 ++++++++++++++++++++++++
src/test/regress/expected/timestamp.out | 15 +++++
src/test/regress/expected/timestamptz.out | 15 +++++
src/test/regress/sql/horology.sql | 9 +++
src/test/regress/sql/timestamp.sql | 8 +++
src/test/regress/sql/timestamptz.sql | 8 +++
10 files changed, 239 insertions(+), 23 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Andres Freund 2019-09-16 23:03:51 Re: pgsql: Allow setting statistics target for extended statistics
Previous Message Andres Freund 2019-09-16 04:47:52 Re: pgsql: Test pg_atomic_fetch_add_ with variable addend and 16-bit edge c