13

Is there an utility to convert mysql query in postgresql query ?

3 Answers 3

8

For DDL you can use mysqldump (see http://en.wikibooks.org/wiki/Converting_MySQL_to_PostgreSQL)

mysqldump --compatible=postgresql databasename > outputfile.sql

For DML I don't know of a tool that would automatically adjust queries from MySQL to PostgreSQL.

Sign up to request clarification or add additional context in comments.

2 Comments

you can also use the -d flag to get only the tables creation sql.
also use SET standard_conforming_strings = 'off'; SET backslash_quote = 'on'; in dump first lines
5

Go to http://www.sqlines.com/online select left side mysql in source past your mysql query and select right side select postgresql in target then click left side on convert button

2 Comments

Handy if you just have a short snippet to convert. It doesn't preserve field comments from CREATE TABLE statements, however.
It's non commercial. Any free option there?
2

See also the PostgreSQL-wiki.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.