Postgres: Error converting date in Postgres 10

Asked

Viewed 224 times

1

When I perform a date conversion on postgres 9.6 that I have on my machine, it fixes the date if it is invalid, the same is not happening on 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 as to what the difference between the banks might be ?

EDIT: Here’s some information on how it should work: http://www.postgresqltutorial.com/postgresql-to_timestamp/#Crayon-5c2381f372207739024582

1 answer

1


Browser other questions tagged

You are not signed in. Login or sign up in order to post.