]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
support JSONB subscripting syntax
authorMike Bayer <mike_mp@zzzcomputing.com>
Fri, 11 Jul 2025 16:51:44 +0000 (12:51 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Sun, 13 Jul 2025 15:58:58 +0000 (11:58 -0400)
commit0f2702caba6a92a47ea618f3080903e95cfe4951
treee6c04ed5bdf08c41a5016536cd9357f251ad2ec2
parent96b11c3ba40cc01823e568e77935b4e6ffd47a9a
support JSONB subscripting syntax

Added support for PostgreSQL 14+ JSONB subscripting syntax. When connected
to PostgreSQL 14 or later, JSONB columns now automatically use the native
subscript notation ``jsonb_col['key']`` instead of the arrow operator
``jsonb_col -> 'key'`` for both read and write operations. This provides
better compatibility with PostgreSQL's native JSONB subscripting feature
while maintaining backward compatibility with older PostgreSQL versions.
JSON columns continue to use the traditional arrow syntax regardless of
PostgreSQL version.

Fixes: #10927
Change-Id: I4b3a8a55a71f2ca3d95416a7b350b785574631eb
(cherry picked from commit 2ac0c459669d0200a4d15162ffc0a8765c60cb07)
doc/build/changelog/unreleased_20/10927.rst [new file with mode: 0644]
lib/sqlalchemy/dialects/postgresql/base.py
test/dialect/postgresql/test_compiler.py
test/dialect/postgresql/test_query.py
test/dialect/postgresql/test_types.py