.. changelog::
:version: 0.9.5
+ .. change::
+ :tags: bug, sql
+ :tickets: 3023
+ :versions: 1.0.0
+
+ The :paramref:`.Column.nullable` flag is implicitly set to ``False``
+ when that :class:`.Column` is referred to in an explicit
+ :class:`.PrimaryKeyConstraint` for that table. This behavior now
+ matches that of when the :class:`.Column` itself has the
+ :paramref:`.Column.primary_key` flag set to ``True``, which is
+ intended to be an exactly equivalent case.
+
.. change::
:tags: enhancement, postgresql
:tickets: 3002
)
eq_(list(t.primary_key), [t.c.b, t.c.c])
+ def test_pk_always_flips_nullable(self):
+ m = MetaData()
+
+ t1 = Table('t1', m, Column('x', Integer), PrimaryKeyConstraint('x'))
+
+ t2 = Table('t2', m, Column('x', Integer, primary_key=True))
+
+ eq_(list(t1.primary_key), [t1.c.x])
+
+ eq_(list(t2.primary_key), [t2.c.x])
+
+ assert t1.c.x.primary_key
+ assert t2.c.x.primary_key
+
+ assert not t2.c.x.nullable
+ assert not t1.c.x.nullable
+
+
class SchemaTypeTest(fixtures.TestBase):
class MyType(sqltypes.SchemaType, sqltypes.TypeEngine):
column = None