Re: Created feature for to_date() conversion using patterns 'YYYY-WW', 'YYYY-WW-D', 'YYYY-MM-W' and 'YYYY-MM-W-D'
От | Tom Lane |
---|---|
Тема | Re: Created feature for to_date() conversion using patterns 'YYYY-WW', 'YYYY-WW-D', 'YYYY-MM-W' and 'YYYY-MM-W-D' |
Дата | |
Msg-id | 14073.1580587253@sss.pgh.pa.us обсуждение исходный текст |
Ответ на | Re: Created feature for to_date() conversion using patterns 'YYYY-WW', 'YYYY-WW-D', 'YYYY-MM-W' and 'YYYY-MM-W-D' (Tom Lane <tgl@sss.pgh.pa.us>) |
Ответы |
Re: Created feature for to_date() conversion using patterns'YYYY-WW', 'YYYY-WW-D', 'YYYY-MM-W' and 'YYYY-MM-W-D'
|
Список | pgsql-hackers |
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 agree on whichever > definition of "a week" you want to use, and then to_date has to > enforce that input uses matching year/week/day field types, > very much like it already does for ISO versus Gregorian dates. A different line of thought could be to accept the current to_char() behavior for WW and D, and go ahead and teach to_date() to invert that. That is, take YYYY plus WW as specifying a seven-day interval, and then D chooses the matching day within that interval. This would still have the property you complained about originally that WW-plus-D don't form a monotonically increasing sequence, but I think that ship has sailed. regards, tom lane
В списке pgsql-hackers по дате отправления: