diesel-rs / diesel

A safe, extensible ORM and Query Builder for Rust
https://diesel.rs
Apache License 2.0
12.79k stars 1.08k forks source link

`.eq_any(ARRAY(subselect))` and `.eq_any(ARRAY[..., ...])` support #4353

Open Ten0 opened 2 days ago

Ten0 commented 2 days ago

As underlined here, there are cases where = ANY(array) does not behave the same as = ANY(subquery), so it may be useful to explicitly convert a subquery into an array.

This PR allows doing this.

It adds support for:

It's technically a breaking change, but only to the extent to which people implemented the AsExpressionList trait manually, or wrote new query fragments that use this as bound, which seems unlikely enough that this can probably be released. (That's only a marker trait for usage of array(...) in its current somewhat-limited version.)