]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
use concat() directly for contains, startswith, endswith
authorMike Bayer <mike_mp@zzzcomputing.com>
Sun, 17 Jul 2022 15:32:27 +0000 (11:32 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Sun, 17 Jul 2022 15:35:19 +0000 (11:35 -0400)
commit0052827c44e9124e89cb3ba5b922b786fe333c9e
tree925a7c40e415e1d51420e7947bc180c33739b235
parentabe993344f18df3aab0f898b6a357e947d23416e
use concat() directly for contains, startswith, endswith

Adjusted the SQL compilation for string containment functions
``.contains()``, ``.startswith()``, ``.endswith()`` to force the use of the
string concatenation operator, rather than relying upon the overload of the
addition operator, so that non-standard use of these operators with for
example bytestrings still produces string concatenation operators.

To accommodate this, needed to add a new _rconcat operator function,
which is private, as well as a fallback in concat_op() that works
similarly to Python builtin ops.

Fixes: #8253
Change-Id: I2b7f56492f765742d88cb2a7834ded6a2892bd7e
(cherry picked from commit 85a88df13ab8d217331cf98392544a888b4d7df3)
doc/build/changelog/unreleased_14/8253.rst [new file with mode: 0644]
lib/sqlalchemy/sql/compiler.py
lib/sqlalchemy/sql/operators.py
test/sql/test_operators.py