]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
Fix PostgreSQL JSONB subscripting regression with functions
authorMike Bayer <mike_mp@zzzcomputing.com>
Fri, 1 Aug 2025 16:48:15 +0000 (12:48 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Mon, 4 Aug 2025 19:06:54 +0000 (15:06 -0400)
commitb5f494e8b9d016b264a71753b260a72bbe2f13a0
treed7d12b7f06a9a4b1100f8a909365e11381c1e9ea
parentaea30bcd130183d8b077cd9452b8b6234f8dfbfe
Fix PostgreSQL JSONB subscripting regression with functions

Fixed regression in PostgreSQL dialect where JSONB subscription syntax
would generate incorrect SQL for JSONB-returning functions, causing syntax
errors. The dialect now properly wraps function calls and expressions in
parentheses when using the ``[]`` subscription syntax, generating
``(function_call)[index]`` instead of ``function_call[index]`` to comply
with PostgreSQL syntax requirements.

Fixes: #12778
Change-Id: If1238457e6bba6a933023b26519a41aa5de4dbcd
(cherry picked from commit d37d56c1ad04a8fb99ff8ed70973197907abf631)
doc/build/changelog/unreleased_20/12778.rst [new file with mode: 0644]
doc/build/tutorial/data_select.rst
lib/sqlalchemy/sql/functions.py
test/dialect/postgresql/test_compiler.py