[postgresql] drop obj wrong order

Alter script generated drop objects in wrong order. Or maybe doesn’t care about objects dependencies.

I have parent and child tables joined by relation.
I modified PK in parent table.

In such case alter script will try to drop PK and create new one.
But it wil cause following error:

ERROR: cannot drop constraint pk_sqlobjects on table dbversions.szn_sql_objects because other objects depend on it
DETAIL: constraint fk_asgntpl_objnametype on table dbversions.tab_sqlobj_assigns_template depends on index dbversions.pk_sqlobjects
HINT: Use DROP … CASCADE to drop the dependent objects too.

Of course droping cascade is not not safe here. Script should take care about objects dependencies. Drop child-related objects first, then parent ones, create new parents and then new child ones.

BTW: I don’t want to start new thread, however I expect simmilar behaviour. DDL script may generate also DROP SCHEMA which will end with error if schama contains some objects. In that case I thing DROP SCHEMA CASCADE would be good solution.

Message was edited by: Michal.K

Hello Michal,

If you can, please send us the two models in which you encountered the problem. It will help us to verify/identify the problem (modeling@quest.com). Thanks very much in advance.

Kind regards,