summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/dialects/postgresql
diff options
context:
space:
mode:
authorMatias Martinez Rebori <matias.martinez@dinapi.gov.py>2022-09-07 12:36:06 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2022-09-08 12:15:23 -0400
commit93aaf16727f1750d74df1f37b86fcbc7f4a8b139 (patch)
treef9c7f122e7851ea7be00d52f4de5ef7575f0d4c2 /lib/sqlalchemy/dialects/postgresql
parent06fe424256a80b91e9ff87b3bbe12ea93bc59453 (diff)
downloadsqlalchemy-93aaf16727f1750d74df1f37b86fcbc7f4a8b139.tar.gz
implement icontains, istartswith, iendswith operators
Added long-requested case-insensitive string operators :meth:`_sql.ColumnOperators.icontains`, :meth:`_sql.ColumnOperators.istartswith`, :meth:`_sql.ColumnOperators.iendswith`, which produce case-insensitive LIKE compositions (using ILIKE on PostgreSQL, and the LOWER() function on all other backends) to complement the existing LIKE composition operators :meth:`_sql.ColumnOperators.contains`, :meth:`_sql.ColumnOperators.startswith`, etc. Huge thanks to Matias Martinez Rebori for their meticulous and complete efforts in implementing these new methods. Fixes: #3482 Closes: #8496 Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/8496 Pull-request-sha: 7287e2c436959fac4fef022f359fcc73d1528211 Change-Id: I9fcdd603716218067547cc92a2b07bd02a2c366b
Diffstat (limited to 'lib/sqlalchemy/dialects/postgresql')
-rw-r--r--lib/sqlalchemy/dialects/postgresql/base.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/sqlalchemy/dialects/postgresql/base.py b/lib/sqlalchemy/dialects/postgresql/base.py
index 75fa3d7c7..18a7c0a86 100644
--- a/lib/sqlalchemy/dialects/postgresql/base.py
+++ b/lib/sqlalchemy/dialects/postgresql/base.py
@@ -1645,6 +1645,9 @@ class PGCompiler(compiler.SQLCompiler):
self.process(binary.right, **kw),
)
+ def visit_ilike_case_insensitive_operand(self, element, **kw):
+ return element.element._compiler_dispatch(self, **kw)
+
def visit_ilike_op_binary(self, binary, operator, **kw):
escape = binary.modifiers.get("escape", None)