wrong order of drop constraint/column statements
От | Miha Radej |
---|---|
Тема | wrong order of drop constraint/column statements |
Дата | |
Msg-id | 4387123B.604@siix.com обсуждение исходный текст |
Список | pgadmin-hackers |
hi! with pgadmin built from a fresh svn checkout i have experienced the following problem, easily reproducible as follows: i am working on an existing table with some columns and constraints placed on them. in the table properties window, columns tab i removed a column and in the constraints tab i removed the constraint placed on that column. pgadmin produced an incorrect statement order, which was drop column... drop constraint... which resulted in an error saying that the constraint specified does not exist (as it got removed along with the column). the statement order should be switched so that the constraint drops are executed before column drops. attached is a patch that works for me (pushes the drop constraint statements before any other statements generated so far) but i do not know if it will break something else somewhere or if there are such things as constraints that depend on other constraints and should therefore be removed in the correct order. cheers, M Index: src/dlg/dlgTable.cpp =================================================================== --- src/dlg/dlgTable.cpp (revision 4759) +++ src/dlg/dlgTable.cpp (working copy) @@ -513,8 +513,9 @@ definition = definition.Mid(1).BeforeFirst('"'); else definition = definition.BeforeFirst(' '); - sql += wxT("ALTER TABLE ") + tabname - + wxT(" DROP CONSTRAINT ") + qtIdent(definition) + wxT(";\n"); + sql = wxT("ALTER TABLE ") + tabname + + wxT(" DROP CONSTRAINT ") + qtIdent(definition) + wxT(";\n") + + sql; } // Add the ADD CONSTRAINTs... sql += tmpsql;
В списке pgadmin-hackers по дате отправления: