-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Add like, not_like and concat for PostgreSQL Bytea #3150
Conversation
I believe, the shortest way is |
4acdafc
to
ae58d93
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for opening this PR 👍
The implementation itself looks good. I would like to see a compile test that demonstrates that code using like
/concat
/not_like
with a binary column only compiles using a postgres connection.
In the current implementation, all of these pg-specific expression methods will be available for all E.g. impl<T> PgTextExpressionMethods for T
where
T: Expression,
T::SqlType: TextOrNullableText,
{
} |
That's what I assumed 😉. So the correct way to fix this is to introduce postgres specific variants of the corresponding operators. It should be easy to define them via the |
ae58d93
to
89ba352
Compare
Ok I see. I think the take-home here is you should never return a type other than those defined in IMO it would be good to make that slightly more obvious. All methods in that file specifically use |
89ba352
to
7a951e4
Compare
7a951e4
to
db88c11
Compare
Thanks for the update 👍 Yes that requirement could made more clear. I would definitively accept a PR adding corresponding comments. Otherwise I try to remember that and will add a comment there myself as soon as I touch that part of the code again. |
I saw a couple of issues requestinhg support for this (e.g. #3127).
This is mostly a copy of
TextExpressionMethods
.Would love to know if there's a more concise way of creating a
Vec<u8>
from a readable literal other than"S%".as_bytes().to_owned())
.