w3resource

PostgreSQL ISFINITE() function


ISFINITE() function

The PostgreSQL ISFINITE() function is used to test if a date, timestamp, or interval is finite (not +/- infinity).

Uses of ISFINITE() Function

  • Date: Test if a date is finite.

  • Timestamp: Test if a timestamp is finite.

  • Interval: Test if an interval is finite.

Syntax:

isfinite(date)
or
isfinite(timestamp)
or
isfinite(interval)

Return Type: boolean.

PostgreSQL Version: 9.3

Visual Presentation of PostgreSQL ISFINITE() function

Pictorial presentation of postgresql ISFINITE function


Example 1: PostgreSQL ISFINITE() function

SQL Code:

SELECT isfinite(date '2002-09-17');

Output:

  isfinite
----------
 t
(1 row)

Example 2: PostgreSQL ISFINITE() function

The isfinite() function is used to get the test for a finite date (not +/-infinity).

SQL Code:

SELECT isfinite(timestamp '2002-09-17 19:27:45');

Output:

 isfinite
----------
 t
(1 row)

Example 3: PostgreSQL ISFINITE() function

This function is used to test for a finite interval.

SQL Code:

SELECT isfinite(interval '7 hours');

Output:

   isfinite
----------
 t
(1 row)

Previous: EXTRACT function
Next: JUSTIFY_DAYS function



Follow us on Facebook and Twitter for latest update.