]> 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:47 +0000 (15:06 -0400)
commitd37d56c1ad04a8fb99ff8ed70973197907abf631
tree1e4b48e69e61329ec64b528056cb7e2bd6f3eeaf
parent893fb6e267f9425f7c578dc181d0791b0351d1a4
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
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