'Backup and restore partitioned tables in PostgreSQL containing check constraints

I have partitioned tables in my database. I want to backup the tables and restore them on the localhost. By using pg_dump, I was able to backup the parent table but the data was not copied in the backup file. When I restore it using psql or pg_restore data, it was not restored. In the case of partition tables, it contains check constraints. What is the solution to backup and restore the partitioned tables with the data?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source