Answer the question
In order to leave comments, you need to log in
Syntax error: How to migrate from MySQL to Postgres?
There is a MySQL database dump - dump.sql , which was given to me by third-party developers. Encoding - cp1251 .
You need to migrate it to postgresql .
What I do:
1) I restore the dump to the database (the developers unload it in their own way, so I decided to do the dump myself)
2) I make my own dump
mysqldump --compatible=postgresql -u root catalog > dump.sql
python db_converter.py dump.sql pg_dump
psql pg_database < pg_dump
START TRANSACTION
SET
SET
SET CONSTRAINTS
invalid command \"?????????
ERROR: syntax error at or near "0"
LINE 5: "price" float NOT NULL DEFAULT '0',
^
Answer the question
In order to leave comments, you need to log in
Well, apparently this cryptic python script of yours does not take into account all the differences between mysql and psql, so even if you fix this particular error (remove the quotes), a bunch of others will come out.
I would recommend using one of the more proven tools to convert the dump.
I do this with the utility https://github.com/lanyrd/mysql-postgresql-converter
invalid command \"?????????Encoding is not correct.
--default-character-set=utf8
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question