mysql2postgresql icon indicating copy to clipboard operation
mysql2postgresql copied to clipboard

date value '0000-00-00' is not accepted in postgresql

Open zormit opened this issue 9 years ago • 4 comments

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.

zormit avatar Jul 16 '15 14:07 zormit

+1

boooch avatar Aug 03 '15 13:08 boooch

My suggestion use 1971-01-01 for this case What You think about this?

mihailShumilov avatar Oct 14 '15 07:10 mihailShumilov

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.

zormit avatar Oct 15 '15 12:10 zormit

Got idea

mihailShumilov avatar Dec 18 '19 09:12 mihailShumilov