detect column conflicts in declarative single table inh

Issue #1732 resolved
Mike Bayer repo owner created an issue
diff -r 19de4da70f714a1918ed1370f9a4ac589f20b7de lib/sqlalchemy/ext/declarative.py
--- a/lib/sqlalchemy/ext/declarative.py Thu Mar 11 12:42:06 2010 -0500
+++ b/lib/sqlalchemy/ext/declarative.py Thu Mar 11 14:29:12 2010 -0500
@@ -679,6 +679,10 @@
                     raise exceptions.ArgumentError(
                         "Can't place primary key columns on an inherited class with no table."
                         )
+                if c.name in inherited_table.c:
+                    raise exceptions.ArgumentError(
+                        "Column '%s' on class %s conflicts with existing column '%s'" % (c, cls, inherited_table.c[c.name](c.name))
+                    )
                 inherited_table.append_column(c)

         # single or joined inheritance

Comments (2)

  1. Log in to comment