projects
/
skytools.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
356df32
)
Remove ONLY from ADD CONSTRAINT.
author
Marko Kreen
<markokr@gmail.com>
Fri, 23 Oct 2009 12:01:55 +0000
(12:01 +0000)
committer
Marko Kreen
<markokr@gmail.com>
Fri, 23 Oct 2009 12:01:55 +0000
(12:01 +0000)
Parent table cannot have contraints that the childs do not have.
python/skytools/dbstruct.py
patch
|
blob
|
blame
|
history
diff --git
a/python/skytools/dbstruct.py
b/python/skytools/dbstruct.py
index 41af18f133e6d510906d725ec64a05f235533826..a64316f8fbd32adcb80216767025b846c5d3484d 100644
(file)
--- a/
python/skytools/dbstruct.py
+++ b/
python/skytools/dbstruct.py
@@
-89,7
+89,9
@@
class TConstraint(TElem):
self.type += T_PKEY
def get_create_sql(self, curs, new_table_name=None):
- 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'):