postgresql_16:9.6.39.4 Usage
PostgreSQL 16 > Appendixes > Additional Supplied Modules and Extensions > seg — a datatype for line segments or floating point intervals > Usage
The seg module includes a GiST index operator class for seg values. The operators supported by the GiST operator class are shown in (see seg-gist-operators).
| Operator Description | | --- | | seg << seg boolean Is the first seg entirely to the left of the second? [a, b] << [c, d] is true if b < c. | | seg >> seg boolean Is the first seg entirely to the right of the second? [a, b] >> [c, d] is true if a > d. | | seg &< seg boolean Does the first seg not extend to the right of the second? [a, b] &< [c, d] is true if b <= d. | | seg &> seg boolean Does the first seg not extend to the left of the second? [a, b] &> [c, d] is true if a >= c. | | seg = seg boolean Are the two segs equal? | | seg && seg boolean Do the two segs overlap? | | seg @> seg boolean Does the first seg contain the second? | | seg <@ seg boolean Is the first seg contained in the second? |
In addition to the above operators, the usual comparison operators shown in (see functions-comparison-op-table) are available for type seg. These operators first compare (a) to (c), and if these are equal, compare (b) to (d). That results in reasonably good sorting in most cases, which is useful if you want to use ORDER BY with this type.