]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
Float and Numeric aren't set as autoincrement
authorFederico Caselli <cfederico87@gmail.com>
Wed, 4 Sep 2024 18:10:45 +0000 (20:10 +0200)
committerFederico Caselli <cfederico87@gmail.com>
Thu, 31 Oct 2024 21:04:01 +0000 (22:04 +0100)
commit9d5f1c0f532749391b51bf3008771a92eb3c2f05
tree02c3d9929098d84606102d94d545f298c2968c67
parentf90917a6418e8287df32da0dca91bf43b469019a
Float and Numeric aren't set as autoincrement

The :class:`.Float` and :class:`.Numeric` types are no longer automatically
considered as auto-incrementing columns when the
:paramref:`_schema.Column.autoincrement` parameter is left at its default
of ``"auto"`` on a :class:`_schema.Column` that is part of the primary key.
When the parameter is set to ``True``, a :class:`.Numeric` type will be
accepted as an auto-incrementing datatype for primary key columns, but only
if its scale is explicitly given as zero; otherwise, an error is raised.
This is a change from 2.0 where all numeric types including floats were
automatically considered as "autoincrement" for primary key columns.

Fixes: #11811
Change-Id: Icdfe084d425166199d6647335c5b53ea5b4b416e
doc/build/changelog/unreleased_21/11811.rst [new file with mode: 0644]
lib/sqlalchemy/sql/schema.py
test/sql/test_defaults.py
test/sql/test_metadata.py