Re: [Bug Report] Week Day

From: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
To: Atila Rangel <atila(dot)rangel(at)cyberlabs(dot)com(dot)br>, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: [Bug Report] Week Day
Date: 2020-02-19 09:07:04
Message-ID: cca4e4dc-32ac-b9ab-039d-98dcb5650791@iki.fi
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On 19/02/2020 04:59, Atila Rangel wrote:
> 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.

The to_char() function pads the weekday names with spaces, as you can
see with this query:

postgres=# select *, 'X' || to_char(some_date, 'day')::text || 'X' from
postgres_report_bug limit 5;
id | some_date | ?column?
----+------------------------+-------------
1 | 2019-11-11 00:00:00+02 | Xmonday X
2 | 2019-11-11 01:00:00+02 | Xmonday X
3 | 2019-11-11 02:00:00+02 | Xmonday X
4 | 2019-11-11 03:00:00+02 | Xmonday X
5 | 2019-11-11 04:00:00+02 | Xmonday X
(5 rows)

You can use 'FMday' instead of 'day' to avoid that.

- Heikki

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Frank Heikens 2020-02-19 09:07:34 Re: [Bug Report] Week Day
Previous Message egocenter 2020-02-19 08:35:08 Full text search bug ('russian' regconfig)