pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #17155: Casting to type date
2+ messages / 2 participants
[nested] [flat]

* BUG #17155: Casting to type date
@ 2021-08-20 11:19 PG Bug reporting form <noreply@postgresql.org>
  2021-08-20 13:36 ` Re: BUG #17155: Casting to type date Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 2+ messages in thread

From: PG Bug reporting form @ 2021-08-20 11:19 UTC (permalink / raw)
  To: pgsql-bugs@lists.postgresql.org; +Cc: 66666666nikita@gmail.com

The following bug has been logged on the website:

Bug reference:      17155
Logged by:          Никита Шумилов
Email address:      66666666nikita@gmail.com
PostgreSQL version: 12.8
Operating system:   Ubuntu
Description:        

In the previous version 12.6, the date cast is handled without errors, but
in version 12.8 this generates an error
SELECT '20.08.2021'::date

ERROR:  date/time field value out of range: "20.08.2021"
LINE 1: SELECT '20.08.2021'::date
               ^
HINT:  Perhaps you need a different "datestyle" setting.
SQL-состояние: 22008
Символ: 8

I know that you can use to_date ('20 .08.2021 ',' DD.MM.YYYY '), but this is
less convenient



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: BUG #17155: Casting to type date
  2021-08-20 11:19 BUG #17155: Casting to type date PG Bug reporting form <noreply@postgresql.org>
@ 2021-08-20 13:36 ` Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 2+ messages in thread

From: Tom Lane @ 2021-08-20 13:36 UTC (permalink / raw)
  To: 66666666nikita@gmail.com; +Cc: pgsql-bugs@lists.postgresql.org

PG Bug reporting form <noreply@postgresql.org> writes:
> In the previous version 12.6, the date cast is handled without errors, but
> in version 12.8 this generates an error
> SELECT '20.08.2021'::date

Nothing has changed in that area in quite some time.  I don't
have a 12.6 installation immediately at hand, but I did find 12.2
laying about on my laptop, and it behaves the same way as 12.8:

$ psql postgres
psql (12.2)
Type "help" for help.

postgres=# SELECT '20.08.2021'::date;
ERROR:  date/time field value out of range: "20.08.2021"
LINE 1: SELECT '20.08.2021'::date;
               ^
HINT:  Perhaps you need a different "datestyle" setting.

The HINT's recommendation is accurate:

postgres=# set datestyle = dmy;
SET
postgres=# SELECT '20.08.2021'::date;
    date    
------------
 2021-08-20
(1 row)

So I suspect you forgot to transfer your datestyle setting to the
new installation.

			regards, tom lane





^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2021-08-20 13:36 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2021-08-20 11:19 BUG #17155: Casting to type date PG Bug reporting form <noreply@postgresql.org>
2021-08-20 13:36 ` Tom Lane <tgl@sss.pgh.pa.us>

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