Table creation with postgresql_inherits and no columns
Issue #3598
resolved
When you create a table that has no columns (everything is inherited from the parent tables). The SQL statement has a erroneous comma.
In [9]: mymeta = MetaData(schema="test")
In [10]: parent = Table("parent", mymeta, Column("a", Integer), Column("b", Integer))
In [11]: child = Table("child_1", mymeta, CheckConstraint('a = 1'), postgresql_inherits="parent")
In [13]: from sqlalchemy.schema import CreateTable
In [14]: print CreateTable(child)
CREATE TABLE test.child_1 (,
CHECK (a = 1)
)
Note the SQL statement sent to postgresql has the INHERIT statement as expected. If you add a dummy column to child everything works as expected.
Comments (5)
-
repo owner -
repo owner - changed status to resolved
- Fixed bug where CREATE TABLE with a no-column table, but a constraint
such as a CHECK constraint would render an erroneous comma in the
definition; this scenario can occur such as with a Postgresql
INHERITS table that has no columns of its own.
fixes
#3598
→ <<cset 9695faf32981>>
-
repo owner - Fixed bug where CREATE TABLE with a no-column table, but a constraint
such as a CHECK constraint would render an erroneous comma in the
definition; this scenario can occur such as with a Postgresql
INHERITS table that has no columns of its own.
fixes
#3598
(cherry picked from commit 9695faf32981406b12a6468b98d5c9b673f8e219)
→ <<cset 7b5fd86a42cf>>
- Fixed bug where CREATE TABLE with a no-column table, but a constraint
such as a CHECK constraint would render an erroneous comma in the
definition; this scenario can occur such as with a Postgresql
INHERITS table that has no columns of its own.
fixes
-
repo owner - changed milestone to 1.0.xx
thanks for reporting!
-
reporter Fantastic thank you.
- Log in to comment
semi-related to #3247 where we can't really reflect a table with no columns of its own...