beanquery
beanquery copied to clipboard
Allow any()/all() on LHS to allow ANY(set) ~ pattern
There were two matching operators:
- subject ~ pattern (case-insensitive)
- pattern ?~ subject (case-sensitive)
This is somewhat confusing for newcomers. The reason maybe is that it allows for this:
SELECT * WHERE "Assets:" ?~ ANY(accounts)
which is used for example by the function has_account by AST transformation. The ANY operator so far was only allowed on the RHS, therefore ~ could not be used for the above example. This commit extends it, so it can be used on either side, allowing for
SELECT WHERE ANY(accounts) ~ "Assets:"
Tests pass, also subqueries within any() are still possible!
Moreover, this Pull request solves the issue that some columns are @registered for the type typing.Set[str] but some functions/operators are registered for set, which did not match. They do now, making functions more flexibly applicable