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

2020-07-10 Thread Tom Lane
I wrote: > Mark Lorenz writes: >> But, nevertheless, what about adding the function to accept the DAY, D >> (and maybe the Q) patterns for to_date() - in this case, of course, in >> the uncorrelated version? to_char() handles them properly. And, from my >> point of view, there is no reason why

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

2020-04-04 Thread Tom Lane
Mark Lorenz writes: > with a bit space to this issue, I re-read your comments. I am beginning > to understand what you mean or - better - what's wrong with my thoughts. > When I understand you correctly, you say, the WW can start at any > weekday, and is not fixed to Sunday, right? In your

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

2020-03-23 Thread Mark Lorenz
Hi Tom, with a bit space to this issue, I re-read your comments. I am beginning to understand what you mean or - better - what's wrong with my thoughts. When I understand you correctly, you say, the WW can start at any weekday, and is not fixed to Sunday, right? In your opinion the WW starts

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

2020-02-28 Thread Alvaro Herrera
I just noticed that this patch has been classified under "bug fixes", but per Tom's comments, this is not a bug fix -- it seems we would need a new format code to implement some different week numbering mechanism. That seems a new feature, not a bug fix. Therefore I propose to move this in

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

2020-02-01 Thread Tom Lane
I wrote: > Either way, though, the WW weeks don't line up with the D weeks, > and we're not likely to make them do so. > So I think an acceptable version of this feature has to involve > defining at least one new format code and maybe as many as three, > to produce year, week and day values that

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

2020-01-31 Thread Tom Lane
Cleysson Lima writes: > this is a review of the patch: chg_to_date_wwd.patch > There hasn't been any problem, at least that I've been able to find. AFAICS, the point of this patch is to make to_date symmetrical with the definition of WW that the other patch wants for to_char. But the other

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

2020-01-31 Thread Cleysson Lima
Em sex., 10 de jan. de 2020 às 09:22, Mark Lorenz escreveu: > Updated the chg_to_date_wwd.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_wwd.patch

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

2020-01-10 Thread Mark Lorenz
Updated the chg_to_date_wwd.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_wwd.patch from f4e740a8de3ad1e762a28f6ff253ea4f%40four-two.de is still

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

2020-01-07 Thread Tom Lane
Mark Lorenz writes: >> Why not? These format codes are specified as >> Dday of the week, Sunday (1) to Saturday (7) >> WW week number of year (1–53) (the first week starts on the first day >> of the year) > I don't want to create any connection here. The day is calculated > correctly.

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

2019-12-20 Thread Mark Lorenz
while preparing the patch for the Commitfest, I found a bug in the to_char() function that is quite correlated with this issue: SELECT to_char('1997-02-01'::date, '-WW-D') returns: 1997-05-7 -> which is ok, I believe. Feb, 1st was on Saturday, so counting from Sundays, it was day 7 of

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

2019-12-20 Thread Mark Lorenz
Hi Tom, thanks for answering! I commited two different patches: --- The first one is for the strange behaviour of to_char(), which could be seen as a bug, I believe. As described earlier, to_char() with the 'WW-D' pattern could return wrong week numbers. The non-ISO week number is

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

2019-12-20 Thread Tom Lane
Mark Lorenz writes: > while preparing the patch for the Commitfest, I found a bug in the > to_char() function that is quite correlated with this issue: > SELECT to_char('1997-02-01'::date, '-WW-D') > returns: 1997-05-7 -> which is ok, I believe. Feb, 1st was on Saturday, > so counting

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

2019-12-20 Thread Tom Lane
Mark Lorenz writes: > I got the advice to split the patches for: > - fixing the to_char() function > - changing the to_date()/to_timestamp() behaviour > So I appended the split patches. I'm a bit skeptical of the premise here. The fine manual says In to_timestamp and to_date, weekday names

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

2019-12-20 Thread Mark Lorenz
Hi, I got the advice to split the patches for: - fixing the to_char() function - changing the to_date()/to_timestamp() behaviour So I appended the split patches. Kind regards, Mark Lorenz From 4e35bd88bef1916e7d11ad0776b3075e3183f7d0 Mon Sep 17 00:00:00 2001 From: Mark Lorenz Date: Fri, 20

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

2019-12-20 Thread Mark Lorenz
Hi, I fixed the described issue in the to char() function. The output of the current version is: postgres=# SELECT to_char('1997-02-01'::date, '-WW-D'); to_char - 1997-05-7 (1 row) postgres=# SELECT to_char('1997-02-03'::date, '-WW-D'); to_char - 1997-05-2 (1 row)

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

2019-12-20 Thread Mark Lorenz
Hi, while preparing the patch for the Commitfest, I found a bug in the to_char() function that is quite correlated with this issue: SELECT to_char('1997-02-01'::date, '-WW-D') returns: 1997-05-7 -> which is ok, I believe. Feb, 1st was on Saturday, so counting from Sundays, it was day 7

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

2019-10-08 Thread Mark Lorenz
Hi, I apologize for the mistake. For the mailing list correspondence I created this mail account. But I forgot to change the sender name. So, the "postgres" name appeared as sender name in the mailing list. I changed it. Kind regards, Mark/S-Man42 Hi, some days ago I ran into a problem

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

2019-10-08 Thread postgres
Hi, some days ago I ran into a problem with the to_date() function. I originally described it on StackExchange: https://dba.stackexchange.com/questions/250111/unexpected-behaviour-for-to-date-with-week-number-and-week-day The problem: If you want to parse a date string with year, week and