Re: [Bug Report] Week Day
От | Frank Heikens |
---|---|
Тема | Re: [Bug Report] Week Day |
Дата | |
Msg-id | F8666474-1915-48EC-B943-DF300EE465A0@mac.com обсуждение исходный текст |
Ответ на | [Bug Report] Week Day (Atila Rangel <atila.rangel@cyberlabs.com.br>) |
Список | pgsql-bugs |
It’s not a bug, this is how to_char() works. From the manual:
day full lower case day name (blank-padded to 9 chars)
day full lower case day name (blank-padded to 9 chars)
It returns 9 characters. And only wednesday is without blanks. Change your where condition to solve the problem.
WITH testcases AS (
SELECT dd
FROM generate_series('2019-11-11'::timestamp, now(), '1 day'::interval) dd
)
SELECT
dd, to_char(dd, 'day'), length(to_char(dd, 'day'))
FROM testcases
WHERE to_char(dd, 'day') IN('monday ','tuesday ')
OR to_char(dd, 'day') =ANY('{"friday "}'::text[]);
Abraço,
Frank
On 19 Feb 2020, at 03:59, Atila Rangel <atila.rangel@cyberlabs.com.br> wrote:<postgres_bug_report.sql>Hi, I'm a software developer working with Postgresql database. Recently, I have had a issue with Week Day queries. Basically, I tried to filter some datetime based on day of week name. I'm sending a sql that you can reproduce the bug. This may not be a bug. But, I would like to report this.
--
В списке pgsql-bugs по дате отправления: