Re: to_char function returning wrong data

Поиск
Список
Период
Сортировка
От Andrew Gierth
Тема Re: to_char function returning wrong data
Дата
Msg-id 87munb5v24.fsf@news-spur.riddles.org.uk
обсуждение исходный текст
Ответ на to_char function returning wrong data  (Sreeni Survi <sreenisurvi@gmail.com>)
Список pgsql-bugs
>>>>> "Sreeni" == Sreeni Survi <sreenisurvi@gmail.com> writes:

 Sreeni> Hi,
 Sreeni> Below code has caused my data to be wiped off a table as my
 Sreeni> where clause depends on the below returned value.

 Sreeni> *select to_char(current_date - interval '5 weeks','IYYYWW') ;*
 Sreeni> *201953*

That's because IYYY is intended for use with IW, not with WW. The output
is correct, it's the query that's wrong.

There are several different definitions of "week number", and IW is the
ISO week, with IYYY being the corresponding year. So 5 weeks ago, which
was Dec 31st 2018, was ISO week 1 of 2019, but in some other week
numbering systems, it was week 53 of 2018.

-- 
Andrew (irc:RhodiumToad)


В списке pgsql-bugs по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: BUG #15602: pg_dump archive items not in correct section order
Следующее
От: Tom Lane
Дата:
Сообщение: Re: to_char function returning wrong data