From: | Peter Eisentraut <peter(at)eisentraut(dot)org> |
---|---|
To: | Vincent Moreau <vincentneko(at)gmail(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org |
Subject: | Re: [PATCH] Add a new pattern for zero-based months for Date/Time Formatting |
Date: | 2025-03-26 09:18:53 |
Message-ID: | b6e5e60e-2b0b-462b-afec-1cd1efd8c132@eisentraut.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On 24.03.25 11:45, Vincent Moreau wrote:
> I came across date information from an external data source where the
> month number is zero-based (January = 0, December = 11) and found that
> I couldn't process it directly using the TO_DATE function.
> This patch introduces a new pattern (MZ) for handling zero-based
> months in Date/Time Formatting.
>
> ## Example
>
> SELECT to_date('01012025', 'DDMZYYYY');
> to_date
> ------------
> 2025-02-01
>
> ## Implementation notes
>
> This is my first patch submission. I have tried to follow the
> guidelines from various documents, but please let me know if anything
> is missing or not aligned with expectations. My apologies in advance
> for any oversights.
Welcome. The patch looks pretty solid as such. But the date formatting
functions are tied into the SQL standard and/or Oracle compatibility, so
we shouldn't just make up our own placeholders without analyzing how
they fit into the larger scheme in terms of compatibility. Moreover, if
there are zero-based months, why not zero-based days, or any of the
other fields? I suspect that this is a pretty marginal use, and you
might be better of trying to work around it externally.
From | Date | Subject | |
---|---|---|---|
Next Message | Bykov Ivan | 2025-03-26 09:31:16 | RE: Query ID Calculation Fix for DISTINCT / ORDER BY and LIMIT / OFFSET |
Previous Message | Pavel Stehule | 2025-03-26 09:12:32 | Re: Allow default \watch interval in psql to be configured |