PostgreSQL isfinite() Function

The PostgreSQL isfinite() function detects whether the given date, timestamp or interval value is finite.

isfinite() Syntax

Here is the syntax of the PostgreSQL isfinite() function:

isfinite(value DATE) -> BOOLEAN
isfinite(value TIMESTAMP) -> BOOLEAN
isfinite(value INTERVAL) -> BOOLEAN

Parameters

value

Required. The value to detect.

Return value

The PostgreSQL isfinite() function returns a boolean value that indicates whether the given date, timestamp, or interval value is finite.

isfinite() Examples

Here are a few examples showing the basic usage of the isfinite() function.

SELECT
    isfinite(DATE '2022-05-16'),
    isfinite(TIMESTAMP '2022-05-16 12:41:13.662522'),
    isfinite(INTERVAL '2 days 10 minutes');
 isfinite | isfinite | isfinite
----------+----------+----------
 t        | t        | t

You can use the isfinite() function check TIMESTAMP 'infinity' if a finite value, for example:

SELECT isfinite(TIMESTAMP 'infinity');
 isfinite
----------
 f