Range Functions
lower(anyrange)
Description: Lower bound of range
Return type: Range's element type
Example:
1 2 3 4 5 |
postgres=#SELECT lower(numrange(1.1,2.2)) AS RESULT; result -------- 1.1 (1 row) |
upper(anyrange)
Description: Upper bound of range
Return type: Range's element type
Example:
1 2 3 4 5 |
postgres=#SELECT upper(numrange(1.1,2.2)) AS RESULT; result -------- 2.2 (1 row) |
isempty(anyrange)
Description: Is the range empty?
Return type: Boolean.
Example:
1 2 3 4 5 |
postgres=#SELECT isempty(numrange(1.1,2.2)) AS RESULT; result -------- f (1 row) |
lower_inc(anyrange)
Description: Is the lower bound inclusive?
Return type: Boolean.
Example:
1 2 3 4 5 |
postgres=#SELECT lower_inc(numrange(1.1,2.2)) AS RESULT; result -------- t (1 row) |
upper_inc(anyrange)
Description: Is the upper bound inclusive?
Return type: Boolean.
Example:
1 2 3 4 5 |
postgres=#SELECT upper_inc(numrange(1.1,2.2)) AS RESULT; result -------- f (1 row) |
lower_inf(anyrange)
Description: Is the lower bound infinite?
Return type: Boolean.
Example:
1 2 3 4 5 |
postgres=#SELECT lower_inf('(,)'::daterange) AS RESULT; result -------- t (1 row) |
upper_inf(anyrange)
Description: Is the upper bound infinite?
Return type: Boolean.
Example:
1 2 3 4 5 |
postgres=#SELECT upper_inf('(,)'::daterange) AS RESULT; result -------- t (1 row) |

The lower and upper functions return null if the range is empty or the requested bound is infinite. The lower_inc, upper_inc, lower_inf, and upper_inf functions all return false for an empty range.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot