default index names can cause collisions in postgres
Issue #162
resolved
given (under postgres)
table_a = Table('table_a', __engine__,
Column('id', Integer, primary_key=True),
Column('name', String(255) , unique=True ),
)
table_b = Table('table_b', __engine__,
Column('id', Integer, primary_key=True),
Column('name', String(255) , unique=True ),
)
both will try to create 'ux_name' as the unique index
an easy workaround is to just explictly state the name of the index
it would be nice though, if sqlalchemy used the same approach that some of the pg admin interfaces use
##tablename####colname##__idx ##tablename####colname##__uidx
so instead of getting 'ux_name' we would have 'table_b__name__uidx'
i've seen some projects use and some use _ as the delimiter. i kind of like
this would make a great enhancement.
Comments (3)
-
Account Deleted -
Account Deleted sorry to do this in 3 parts...
i just wanted to add what the defaults are for the postgres commandline client, in case some people are more preferential to that (i'm not. i like the __ and idx )
primary key ##tablename##_##colname##_pkey unique ##tablename##_##colname##_key
-
repo owner - changed status to resolved
the indexing has been modified some changesets ago to handle this
- Log in to comment
I forgot to encapsulate some of the above to be wikisafe