Table creation with postgresql_inherits and no columns

Issue #3598 resolved
Joel Sanger created an issue

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)

  1. Mike Bayer 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

    → <<cset 9695faf32981>>

  2. Log in to comment