Suppose we have an array:
ARRAY[1,2,3]
With the operator <@ I can query whether the left-operand is a sub-array of the right-operand:
ARRAY[1, 2] <@ ARRAY[1,2,3]
The above works greatly but now let's take the following case:
ARRAY[1, 2] <@ ARRAY[1,3,7]
In this case the above will return false as expected.
Do we have an operator which says the following:
- either the left array is contained by the right array
- or each of the elements in the left array IS NOT contained at all in the right array?
As of today I can easily come up with a solution involving the overlap operator but it is not really what I am looking for. It complicated enormously my query and I would need to do some more complicated string machinery on the application side to build the query.
I am using PostgreSQL 13.