Re: Created feature for to_date() conversion using patterns 'YYYY-WW', 'YYYY-WW-D', 'YYYY-MM-W' and 'YYYY-MM-W-D'

From: Cleysson Lima <cleyssondba(at)gmail(dot)com>
To: Mark Lorenz <postgres(at)four-two(dot)de>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Created feature for to_date() conversion using patterns 'YYYY-WW', 'YYYY-WW-D', 'YYYY-MM-W' and 'YYYY-MM-W-D'
Date: 2020-01-31 22:34:18
Message-ID: CAEPXaE1n3g2hc4yfsM2VdmUg+LL_KL37e-WF4oYqUk8fG0zhjg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Em sex., 10 de jan. de 2020 às 09:22, Mark Lorenz <postgres(at)four-two(dot)de>
escreveu:

> Updated the chg_to_date_yyyywwd.patch with additional tests (because it
> works not only for 'D' pattern but also for all day patterns like 'Day'
> or 'DY'). Added the necessary documentation change.
>
> (The fix_to_char_yyyywwd.patch from
> f4e740a8de3ad1e762a28f6ff253ea4f%40four-two.de is still up-to-date)

The following review has been posted through the commitfest application:
make installcheck-world: tested, passed
Implements feature: tested, passed
Spec compliant: tested, passed
Documentation: not tested

Hi Mark,

this is a review of the patch: chg_to_date_yyyywwd.patch

There hasn't been any problem, at least that I've been able to find.

This one applies cleanly.

The entire compilation went without error as well.

############# Without patch #############

postgres=# SELECT to_date('2019-1-1', 'YYYY-WW-D');
to_date
------------
2019-01-01
(1 row)

postgres=# SELECT to_date('2019-1-2', 'YYYY-WW-D');
to_date
------------
2019-01-01
(1 row)

postgres=# SELECT to_date('2019-1-9', 'YYYY-WW-D');
to_date
------------
2019-01-01
(1 row)

############# With patch #############

postgres=# SELECT to_date('2019-1-1', 'YYYY-WW-D');
to_date
------------
2018-12-30
(1 row)

postgres=# SELECT to_date('2019-1-2', 'YYYY-WW-D');
to_date
------------
2018-12-31
(1 row)

postgres=# SELECT to_date('2019-1-9', 'YYYY-WW-D');
to_date
------------
2019-01-07
(1 row)

+1 for committer review

--
Cleysson Lima

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alexey Kondratov 2020-01-31 23:16:22 Re: [Patch] pg_rewind: options to use restore_command from recovery.conf or command line
Previous Message Tom Lane 2020-01-31 22:28:16 Re: PATCH: Fix wrong size argument to pg_strncasecmp