A
A
Andrey2015-09-28 10:27:54
MySQL
Andrey, 2015-09-28 10:27:54

Migrating from Mysql to PostgreSQL, how to disable key checking?

Good afternoon!
I need to migrate Django database from Mysql to PostgreSQL.
Never worked with PostgreSQL.
I came across the Python library mysql2pgsql.
Installed, configured, it turned out the database works!
But to be sure, I want to:
1. From the database that was obtained using mysql2pgsql, dump only the data.
2. Using Django migrate create a clean database.
3. Fill in a clean database with data from mysql2pgsql.
I found how to make a backup purely with data in the docks, but I just can’t figure out how to disable the check of foreign keys (as in MySQL), otherwise errors occur during import and nothing is uploaded ?!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey, 2015-09-28
Protko @Fesor

As it does not work in mysql, postgres needs special user rights for this, and then you can disable triggers for all tables.
But an easier option is to make all foreign keys DEFERRABLE, so that when importing data, we can simply wrap this business in a transaction, and the data integrity check will be performed only after it is committed.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question