eulerto / pgquarrel

pgquarrel compares PostgreSQL database schemas (DDL)
BSD 3-Clause "New" or "Revised" License
389 stars 42 forks source link

Group `CREATE TABLE` statements #68

Open grzegorzk opened 5 years ago

grzegorzk commented 5 years ago

When some tables reference each other through foreign keys it would be good to first issue CREATE TABLE statements and then, once all tables had been created, add any constraints/foreign keys.

grzegorzk commented 5 years ago

There is more fundamental issue with statements generated by the tool that rely each on other.

Example - I can have some functions that operate on tables and some other functions that I then use to build indexes and if order of CREATE statements is incorrect then the script will fail.

Not to mention one function may depend on another function.

hazardland commented 3 years ago

@grzegorzk did you solve this case?

I have similar issue: table_child references table_parent with foreign key but table_child is created first and then table_parent