]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
Improve identity column reflection
authorFederico Caselli <cfederico87@gmail.com>
Mon, 3 Mar 2025 22:35:48 +0000 (23:35 +0100)
committerMike Bayer <mike_mp@zzzcomputing.com>
Fri, 7 Mar 2025 00:27:37 +0000 (19:27 -0500)
commit1658ce34fcf05d7ec25633431377a066a95b1cdf
treea43a5b869e63b16b24565ee36f7137627e1fac3f
parent1db6ee03c91cdcb618bac3c5119861656ba16521
Improve identity column reflection

Add SQL typing to reflection query used to retrieve a the structure
of IDENTITY columns, adding explicit JSON typing to the query to suit
unusual PostgreSQL driver configurations that don't support JSON natively.

Fixed issue affecting PostgreSQL 17.3 and greater where reflection of
domains with "NOT NULL" as part of their definition would include an
invalid constraint entry in the data returned by
:meth:`_postgresql.PGInspector.get_domains` corresponding to an additional
"NOT NULL" constraint that isn't a CHECK constraint; the existing
``"nullable"`` entry in the dictionary already indicates if the domain
includes a "not null" constraint.   Note that such domains also cannot be
reflected on PostgreSQL 17.0 through 17.2 due to a bug on the PostgreSQL
side; if encountering errors in reflection of domains which include NOT
NULL, upgrade to PostgreSQL server 17.3 or greater.

Fixes: #11751
Change-Id: I8e69de51601dca3257186e38c6f699fbfd9014c6
(cherry picked from commit b23b6db14ac33a792520a5036af1ab02157b7df6)
doc/build/changelog/unreleased_20/11751.rst [new file with mode: 0644]
lib/sqlalchemy/dialects/postgresql/base.py
test/dialect/postgresql/test_reflection.py