From 7c61751b50809ade03179f3b6ee136e78681013f Mon Sep 17 00:00:00 2001 From: Marko Kreen Date: Wed, 28 Oct 2009 15:34:27 +0200 Subject: [PATCH] dbstruct: Remove ONLY from ADD CONSTRAINT. Parent table cannot have contraints that the childs do not have. --- python/skytools/dbstruct.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/python/skytools/dbstruct.py b/python/skytools/dbstruct.py index 916de131..8e559036 100644 --- a/python/skytools/dbstruct.py +++ b/python/skytools/dbstruct.py @@ -93,7 +93,9 @@ class TConstraint(TElem): def get_create_sql(self, curs, new_table_name=None): """Generate creation SQL.""" - fmt = "ALTER TABLE ONLY %s ADD CONSTRAINT %s %s;" + # no ONLY here as table with childs (only case that matters) + # cannot have contraints that childs do not have + fmt = "ALTER TABLE %s ADD CONSTRAINT %s %s;" if new_table_name: name = self.name if self.contype in ('p', 'u'): -- 2.39.5