Postgres Import with Foreign Keys

chd.david's profile image chd.david posted 3 years ago in Import/Export Permalink

Hi,

first of all, thanks for the great work. I used HeidiSQL with MySQL and MariaDB for over a decade. I had to switch to Postgres recently due to better support by my application framework. I am very happy to see, that the support in HeidiSQL for Postgres was getting better in the last releases.

I encountered some issues with a postgres export an reimport. I am not sure if this is the expected behaviour.

This is what I did: I exported a Postgress database to a sql file. First I selected INSERT IGNORE. The reimport to a new empty database did not start.

Then I selcected only INSERT. The import started but it had problems with the foreign key constraints of my database. My solution was to add the following line to beginning of the sql file: SET session_replication_role = replica; And at the end of the file back to: SET session_replication_role = origin

My question is: Should this be added on postgres export/import by default? maybe as a special option in the Options Dropdown?

Greetings from Braunschweig

David

ansgar's profile image ansgar posted 3 years ago Permalink

I'm not sure about the pros and cons of that session_replication_role variable. But please note that HeidiSQL's SQL export was originally built for MySQL and MariaDB - all other systems are not fully supported, at least not for the DDL statements like CREATE TABLE.. and friends.

pmcs's profile image pmcs posted 3 years ago Permalink

I think Heidi should be advertised as offering partial support for Postgres. I had lot of success with Heidi+MySQL in the past but encountering lots of showstoppers with Postgres, and the import/export is one of them.

Please login to leave a reply, or register at first.