Skip to content
Discussion options

You must be logged in to vote

Currently you can't do this directly. As an alternative you could use the cs operator which is equivalent to @> in PostgreSQL (not sure about the performance difference, though). The request would be /posts?tags=cs.{blog} and it represents this query:

select * from posts where tags @> '{"blog"}';

If you want to keep using any you could use a FUNCTION with the tag as parameters, or if you use that specific filter 'blog' = any(tags) a lot, then a VIEW or a generated column could work. There's a pending enhancement related to the any operator here #1569.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by metrue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #2318 on June 14, 2022 17:35.