]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
CAST the elements in ARRAYs when using psycopg2
authorFederico Caselli <cfederico87@gmail.com>
Wed, 10 Mar 2021 22:54:52 +0000 (23:54 +0100)
committerMike Bayer <mike_mp@zzzcomputing.com>
Tue, 16 Mar 2021 00:11:20 +0000 (20:11 -0400)
commitdfa1d3b28f1a0abf1e11c76a94f7a65bf98d29af
tree975a06018edcc9a9fa75b709f40698842a82e494
parent28b0b6515af26ee3ba09600a8212849b2dae0699
CAST the elements in ARRAYs when using psycopg2

Adjusted the psycopg2 dialect to emit an explicit PostgreSQL-style cast for
bound parameters that contain ARRAY elements. This allows the full range of
datatypes to function correctly within arrays. The asyncpg dialect already
generated these internal casts in the final statement. This also includes
support for array slice updates as well as the PostgreSQL-specific
:meth:`_postgresql.ARRAY.contains` method.

Fixes: #6023
Change-Id: Ia7519ac4371a635f05ac69a3a4d0f4e6d2f04cad
13 files changed:
doc/build/changelog/unreleased_13/6023.rst [new file with mode: 0644]
lib/sqlalchemy/dialects/postgresql/array.py
lib/sqlalchemy/dialects/postgresql/psycopg2.py
lib/sqlalchemy/sql/crud.py
lib/sqlalchemy/sql/sqltypes.py
lib/sqlalchemy/sql/type_api.py
lib/sqlalchemy/testing/__init__.py
lib/sqlalchemy/testing/config.py
lib/sqlalchemy/testing/plugin/pytestplugin.py
lib/sqlalchemy/testing/schema.py
test/dialect/postgresql/test_compiler.py
test/dialect/postgresql/test_types.py
test/sql/test_types.py