Postgres: Error converting data in Postgres 10

2

When I run a date conversion on postgres 9.6 that I have on my machine, it corrects the date if it is invalid, the same is not happening in postgres 10 that is on another machine:

Postgres 9.6

DateStyle = ISO, DMY
server_encoding = UTF8
TimeZone = America / Sao_Paulo

SELECT to_timestamp('01/12/2018 24:00:00', 'dd/MM/yyyy HH24/MI/SS')
  Resultado: 02/12/2018 00:00:00
SELECT to_timestamp('31/11/2018 00:00:00', 'dd/MM/yyyy HH24/MI/SS')
  Resultado: 01/12/2018 00:00:00

Postgres 10

DateStyle = ISO, DMY
server_encoding = UTF8
TimeZone = America / Sao_Paulo

SELECT to_timestamp('01/12/2018 24:00:00', 'dd/MM/yyyy HH24/MI/SS')
  ERROR: date/time field value out of range: "01/12/2018 24:00:00"
SELECT to_timestamp('31/11/2018 00:00:00', 'dd/MM/yyyy HH24/MI/SS')
  ERROR: date/time field value out of range: "31/12/2018 00:00:00"

Any clue what the difference might be between banks?

EDIT: Here is some information on how it should work: link

    
asked by anonymous 26.12.2018 / 18:53

1 answer

1

Because from version 10 onwards, you've rejected invalid dates. See the Release Notes (Appendix E):

link

E.9.3.6. Functions

Make to_timestamp () and to_date () reject out-of-range input fields (Artur Zakirov)

    
27.12.2018 / 21:05