maxlapshin / mysql2postgres

Mysqldump, writing in postgresql format
MIT License
709 stars 156 forks source link

problem with conversion of mysql bit(1) to postgres boolean #27

Closed yanky80 closed 8 years ago

yanky80 commented 13 years ago

Hi all:

I have tried to migrate a mysql database to postgres, and got some errors. Here is the error log: psql:/opt/cth/data/cth20110323_data_pg.sql:756407: error: invalid boolean type input syntax: "" background: COPY coordinator, row 3, col haszone: ""

I checked mysql database and the generated sql script for postgres, and found that "haszone" field is bit(1) type in mysql, bit(1) is stored as binary value in mysql, and this binary value is not written to sql script file correctly. Actually this issue is explained on "Notes, Limitations, Outstanding Issues.." section, but that tweak doesn't work for me.

If bit(1) could be converted to t/f in generated sql, that would be great.

thanks for your work.

jcoleman commented 13 years ago

I've fixed the handling of boolean conversion both for the BIT(1) data type and also for the TINYINT(1) data type where the value is not 0 or 1. The fix corrects the handling for default values and field values. See the pull request at tardate's fork at https://github.com/tardate/mysql2postgres/pull/4.

My fork is at: https://github.com/jcoleman/mysql2postgres.

paazmaya commented 8 years ago

Closing as an old issue, that would seem to be out of date. Feel free to re-open and update with comments aganst the master branch.