Table 9-45 shows the operators available for array types.
Table 9-45. Array Operators
Operator | Description | Example | Result |
---|---|---|---|
= | equal | ARRAY[1.1,2.1,3.1]::int[] = ARRAY[1,2,3] | t |
<> | not equal | ARRAY[1,2,3] <> ARRAY[1,2,4] | t |
< | less than | ARRAY[1,2,3] < ARRAY[1,2,4] | t |
> | greater than | ARRAY[1,4,3] > ARRAY[1,2,4] | t |
<= | less than or equal | ARRAY[1,2,3] <= ARRAY[1,2,3] | t |
>= | greater than or equal | ARRAY[1,4,3] >= ARRAY[1,4,3] | t |
@> | contains | ARRAY[1,4,3] @> ARRAY[3,1] | t |
<@ | is contained by | ARRAY[2,7] <@ ARRAY[1,7,4,2,6] | t |
&& | overlap (have elements in common) | ARRAY[1,4,3] && ARRAY[2,1] | t |
|| | array-to-array concatenation | ARRAY[1,2,3] || ARRAY[4,5,6] | {1,2,3,4,5,6} |
|| | array-to-array concatenation | ARRAY[1,2,3] || ARRAY[[4,5,6],[7,8,9]] | {{1,2,3},{4,5,6},{7,8,9}} |
|| | element-to-array concatenation | 3 || ARRAY[4,5,6] | {3,4,5,6} |
|| | array-to-element concatenation | ARRAY[4,5,6] || 7 | {4,5,6,7} |