]> 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:26:19 +0000 (19:26 -0500)
commitb23b6db14ac33a792520a5036af1ab02157b7df6
treef4fce49e76fd58dbbc3be1d4553ec2d37f2be25f
parentd6f11d9030b325d5afabf87869a6e3542edda54b
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
doc/build/changelog/unreleased_20/11751.rst [new file with mode: 0644]
lib/sqlalchemy/dialects/postgresql/base.py
test/dialect/postgresql/test_reflection.py