I've got 40+ tables, millions of rows per table, hundreds of foreign key relationships and constraints.
I would like to get the entire exact table structure copied over but with say maybe a few hundred or a few thousand rows for creating light development environments.
Thus far, I've only seen pg_dump which, while it can export a single table's partial rows, has no way of exporting a partial database with a few rows per table while maintaining referential integrity, that is, if a table depends on some foreign key, make sure there are certain values of that foreign key in the referenced table too so the relationship is intact.
Given the massive number of tables (which change quite frequently), it would be challenging to create and maintain manual INSERT commands for so many tables.
Is there any solution for this? (for postgresql specifically)
Did you try Jailer? I have had good experiences with it.
Features: