]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
add explicit REGCONFIG, pg full text functions
authorMike Bayer <mike_mp@zzzcomputing.com>
Wed, 14 Dec 2022 01:07:14 +0000 (20:07 -0500)
committerMike Bayer <mike_mp@zzzcomputing.com>
Thu, 15 Dec 2022 15:36:48 +0000 (10:36 -0500)
commit7b84c850606c7b093b4260c08ff4636ff1bdbfef
treea2500d653134f05981ea3b6618ff63dcefa91716
parente0eea374c2df82f879d69b99ba2230c743bbae27
add explicit REGCONFIG, pg full text functions

Added support for explicit use of PG full text functions with asyncpg and
psycopg (SQLAlchemy 2.0 only), with regards to the ``REGCONFIG`` type cast
for the first argument, which previously would be incorrectly cast to a
VARCHAR, causing failures on these dialects that rely upon explicit type
casts. This includes support for :class:`_postgresql.to_tsvector`,
:class:`_postgresql.to_tsquery`, :class:`_postgresql.plainto_tsquery`,
:class:`_postgresql.phraseto_tsquery`,
:class:`_postgresql.websearch_to_tsquery`,
:class:`_postgresql.ts_headline`, each of which will determine based on
number of arguments passed if the first string argument should be
interpreted as a PostgreSQL "REGCONFIG" value; if so, the argument is typed
using a newly added type object :class:`_postgresql.REGCONFIG` which is
then explicitly cast in the SQL expression.

Fixes: #8977
Change-Id: Ib36698a984fd4194bd6e0eb663105f790f3db7d3
doc/build/changelog/unreleased_20/8977.rst [new file with mode: 0644]
doc/build/dialects/postgresql.rst
lib/sqlalchemy/dialects/postgresql/__init__.py
lib/sqlalchemy/dialects/postgresql/asyncpg.py
lib/sqlalchemy/dialects/postgresql/base.py
lib/sqlalchemy/dialects/postgresql/ext.py
lib/sqlalchemy/dialects/postgresql/psycopg.py
lib/sqlalchemy/dialects/postgresql/types.py
test/dialect/postgresql/test_compiler.py
test/dialect/postgresql/test_query.py