</tbody>
</tgroup>
</table>
+
+ <para>
+ The <function>lower</> and <function>upper</> functions return null
+ if the range is empty or the requested bound is infinite.
+ The <function>lower_inc</function>, <function>upper_inc</function>,
+ <function>lower_inf</function>, and <function>upper_inf</function>
+ functions all return false for an empty range.
+ </para>
</sect1>
<sect1 id="functions-aggregate">
range_deserialize(fcinfo, r1, &lower, &upper, &empty);
- if (empty)
- ereport(ERROR,
- (errcode(ERRCODE_DATA_EXCEPTION),
- errmsg("empty range has no lower bound")));
- if (lower.infinite)
- ereport(ERROR,
- (errcode(ERRCODE_DATA_EXCEPTION),
- errmsg("range lower bound is infinite")));
+ /* Return NULL if there's no finite lower bound */
+ if (empty || lower.infinite)
+ PG_RETURN_NULL();
PG_RETURN_DATUM(lower.val);
}
range_deserialize(fcinfo, r1, &lower, &upper, &empty);
- if (empty)
- ereport(ERROR,
- (errcode(ERRCODE_DATA_EXCEPTION),
- errmsg("empty range has no upper bound")));
- if (upper.infinite)
- ereport(ERROR,
- (errcode(ERRCODE_DATA_EXCEPTION),
- errmsg("range upper bound is infinite")));
+ /* Return NULL if there's no finite upper bound */
+ if (empty || upper.infinite)
+ PG_RETURN_NULL();
PG_RETURN_DATUM(upper.val);
}