From: Heikki Linnakangas <hlinnaka@iki.fi>
To: Atila Rangel <atila.rangel@cyberlabs.com.br>
To: pgsql-bugs@lists.postgresql.org
Subject: Re: [Bug Report] Week Day
Date: Wed, 19 Feb 2020 11:07:04 +0200
Message-ID: <cca4e4dc-32ac-b9ab-039d-98dcb5650791@iki.fi> (raw)
In-Reply-To: <CA+Ua9TtsZt96pV3CsTE6=Gb0HmfMQdpGdJLPxZRfb8dPuszw7Q@mail.gmail.com>
References: <CA+Ua9TtsZt96pV3CsTE6=Gb0HmfMQdpGdJLPxZRfb8dPuszw7Q@mail.gmail.com>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: hlinnaka@iki.fi, atila.rangel@cyberlabs.com.br
Subject: Re: [Bug Report] Week Day
In-Reply-To: <cca4e4dc-32ac-b9ab-039d-98dcb5650791@iki.fi>
References: <CA+Ua9TtsZt96pV3CsTE6=Gb0HmfMQdpGdJLPxZRfb8dPuszw7Q@mail.gmail.com> <cca4e4dc-32ac-b9ab-039d-98dcb5650791@iki.fi>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox