]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
Cast empty PostgreSQL ARRAY from the type specified to array()
authorDenis Laxalde <denis@laxalde.org>
Wed, 19 Mar 2025 08:17:27 +0000 (04:17 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Wed, 19 Mar 2025 23:32:09 +0000 (19:32 -0400)
commit588cc6ed8e95f3fdd0920fd49a0992e7739662fc
treec1db7f58bf881c2e8fffb816cdd5cf75ab2caf2c
parenta385bd9b50676d6f330471c182793467396bcdf9
Cast empty PostgreSQL ARRAY from the type specified to array()

When building a PostgreSQL ``ARRAY`` literal using
:class:`_postgresql.array` with an empty ``clauses`` argument, the
:paramref:`_postgresql.array.type_` parameter is now significant in that it
will be used to render the resulting ``ARRAY[]`` SQL expression with a
cast, such as ``ARRAY[]::INTEGER``. Pull request courtesy Denis Laxalde.

Fixes: #12432
Closes: #12435
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/12435
Pull-request-sha: 9633d3c15d42026f8f45f5a4d201a5d72e57b8d4

Change-Id: I29ed7bd0562b82351d22de0658fb46c31cfe44f6
doc/build/changelog/unreleased_20/12432.rst [new file with mode: 0644]
lib/sqlalchemy/dialects/postgresql/array.py
lib/sqlalchemy/dialects/postgresql/base.py
test/dialect/postgresql/test_compiler.py
test/dialect/postgresql/test_query.py
test/sql/test_compare.py