> For the complete documentation index, see [llms.txt](https://til.yulrizka.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://til.yulrizka.com/db/disabling-foreign-key-when-importing-dump.md).

# disabling foreign key when importing dump

After dumping the whole database with `pgdump` and try to execute the file, I found a lot of constrain being violated. This could be because the order of insertion does not match with schema foreign key.

To fix that, add this following statement to the beginning of the import file

```sql
SET session_replication_role = replica;
```
