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

From: Mark Lorenz <postgres(at)four-two(dot)de>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Cleysson Lima <cleyssondba(at)gmail(dot)com>, 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-03-23 11:36:59
Message-ID: 9a3aa1695c6736a5010280d11c483b57@four-two.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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 with the weekday of Jan, 1st? That's what could be my problem: I
always thought (maybe triggered through the D pattern), that WW has to
start sundays. But, now I agree with you, the docs fit better to your
interpretation:

"the first week starts on the first day of the year"

I interpreted it with: It starts on the week, which includes the first
of the year, but the Sunday before.

Did I understand you correctly? In that case, I accept, that my patch is
no bugfix (I think, it would be one, if my interpretion would be the
expected behaviour.).

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 they should give "1" instead the
real day number. What do you think?

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Fujii Masao 2020-03-23 12:01:04 Re: WAL usage calculation patch
Previous Message Andy Fan 2020-03-23 11:17:56 Re: Index Skip Scan