]> 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>
Thu, 20 Mar 2025 00:19:08 +0000 (20:19 -0400)
commitcd2b95192bd292cbfe99a0eaae2a6b86bece5a7a
treec7410f1e65bc507fb61809de202a50f199f8fc8b
parent56e0924ef8b387e0bc294784a76e6172f624d3a2
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
(cherry picked from commit 588cc6ed8e95f3fdd0920fd49a0992e7739662fc)
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