-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ensure concat ops are used for contains / startswith / endswith independently of datatype #8253
Comments
So I dont think a document here is sufficient, because people tend not to find docs like these. What I would prefer is:
1 is likely preferable |
.contains()
, .like()
, etc. .contains()
, .like()
, etc.
.contains()
, .like()
, etc.
Mike Bayer has proposed a fix for this issue in the main branch: use concat() directly for contains, startswith, endswith https://gerrit.sqlalchemy.org/c/sqlalchemy/sqlalchemy/+/3996 |
Mike Bayer has proposed a fix for this issue in the rel_1_4 branch: use concat() directly for contains, startswith, endswith https://gerrit.sqlalchemy.org/c/sqlalchemy/sqlalchemy/+/3997 |
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 85a88df)
Describe the use case
The existing documentation for these methods only has examples using strings. The examples are not applicable to VARBINARY columns where the queries fail.
Databases / Backends / Drivers targeted
N/A
Example Use
The respective sections of documentation should be updated with edited text equivalent to the suggestions below:
ColumnOperators.contains()
like()
method to represent.contains()
:Using
.contains()
with the same concatenations will produce an equivalent result.ColumnOperators.startswith()
like()
method to represent.startswith()
:Using
.startswith()
with the same concatenations will produce an equivalent result.ColumnOperators.endswith()
like()
method to represent.endswith()
:Using
.endswith()
with the same concatenations will produce an equivalent result.Additional context
N/A
The text was updated successfully, but these errors were encountered: