mysql2postgresql
mysql2postgresql copied to clipboard
date value '0000-00-00' is not accepted in postgresql
Problem: Having a MySQL date field with an undefined date 0000-00-00
, it will be the same value in the output. Resulting in:
ERROR: date/time field value out of range: "0000-00-00"
Solution: It should be NULL
instead, because that seems to be the Postgres standard for an undefined date.
+1
My suggestion use 1971-01-01 for this case What You think about this?
I think if NULL
is allowed, it's better to replace by NULL
, as every other date could interfere with the regularly stored dates and it seems to be the only value in postgres representing "undefined". Maybe an option should be used to let the user decide, what to do when the date is a NOT NULL
column. This option could then default to 1971-01-01.
Got idea