We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
CREATE TABLE example ( values text[] )
If I want to check if a value is in values, this is how i would write the SQL "raw".
values
SELECT values FROM example WHERE "boop" = any(values);
I looked around but didn't see a native way to express this. I ended up doing this instead:
Query:select() .cond_where( Expr::cust_with_values("? = any(populated_fields)", [prop_name.clone()]) )
Native support for checking if a value is in an array would be nice.
The .contains method generates @>, which will fail if a single value is provided since it requires both operands to be arrays.
.contains
@>
I also found that .is_in([my_value]), which produces IN ($1) also fails.
.is_in([my_value])
IN ($1)
In both cases it'll give you the error "operator does not exist: text[] = text".
"operator does not exist: text[] = text"
ANY is described in the postgresql docs here: https://www.postgresql.org/docs/current/functions-comparisons.html#id-1.5.8.30.16
ANY
Checking if a value is in an array seems like a reasonable thing to do, and in general supporting array operations.
The text was updated successfully, but these errors were encountered:
SOME
ALL
Successfully merging a pull request may close this issue.
Summary
If I want to check if a value is in
values
, this is how i would write the SQL "raw".I looked around but didn't see a native way to express this. I ended up doing this instead:
Native support for checking if a value is in an array would be nice.
The
.contains
method generates@>
, which will fail if a single value is provided since it requires both operands to be arrays.I also found that
.is_in([my_value])
, which producesIN ($1)
also fails.In both cases it'll give you the error
"operator does not exist: text[] = text"
.ANY
is described in the postgresql docs here: https://www.postgresql.org/docs/current/functions-comparisons.html#id-1.5.8.30.16Motivation
Checking if a value is in an array seems like a reasonable thing to do, and in general supporting array operations.
Additional Information
The text was updated successfully, but these errors were encountered: