What is an "infinity" timestamp?

Moderator: NorbertKrupa

Post Reply
User avatar
fsalvelt
Intermediate
Intermediate
Posts: 54
Joined: Sun Mar 18, 2012 1:34 am

What is an "infinity" timestamp?

Post by fsalvelt » Tue Jul 17, 2012 1:41 pm

Hello,

Can someone please explain what is the purpose of the "infinity" timestamp value?

Code: Select all

dbadmin=> select TIMESTAMP 'INFINITY';
 ?column?
----------
 infinity
(1 row)
Is it just an invalid date?
Thank, Fred

User avatar
JimKnicely
Site Admin
Site Admin
Posts: 1825
Joined: Sat Jan 21, 2012 4:58 am
Contact:

Re: What is an "infinity" timestamp?

Post by JimKnicely » Thu Aug 09, 2012 2:02 am

Hi,

When dealing with timestamps, INFINITY is a placeholder value representing a date greater than all other dates while negative INFINITY is a placeholder value representing a date that is less than all other dates...

Example:

Code: Select all

dbadmin=> create table temp (col1 timestamp);
CREATE TABLE
dbadmin=> insert into temp values (TIMESTAMP 'infinity');
 OUTPUT
--------
      1
(1 row)

dbadmin=> insert into temp values (TIMESTAMP '-infinity');
 OUTPUT
--------
      1
(1 row)

dbadmin=> select col1 from temp;
   col1
-----------
 infinity
 -infinity
(2 rows)
In the following query we see that SYSDATE is less than INFINITY:

Code: Select all

dbadmin=> select col1 from temp where sysdate < col1;
   col1
----------
 infinity
(1 row)
And in the next query we see that negative INFINITY is less than SYSDATE:

Code: Select all

dbadmin=> select col1 from temp where col1 < sysdate;
   col1
-----------
 -infinity
(1 row)
Jim Knicely

Image

Note: I work for Vertica. My views, opinions, and thoughts expressed here do not represent those of my employer.

Post Reply

Return to “New to Vertica Database Development”