When using the ltree
PostgreSQL extension, there are these two operators (among others) at our disposal to compare ltree
columns to lquery
s.
ltree ~ lquery
ltree ? lquery[]
It seems that you should use ~
for single queries and ?
for multiple queries. However, you can also join queries with the use of the |
logical OR operator.
So, these two are equivalent when it comes to the queried results:
ltree ~ lquery1 || "|" || lquery2
ltree ? {lquery1, lquery2}
Which of these forms should I prefer?