Skip site navigation (1) Skip section navigation (2)

Re: [SQL] how to cast localtimestamp to bigint???

From: Edmund Bacon <ebacon(at)onesystem(dot)com>
To: "Pradeepkumar, Pyatalo (IE10)" <Pradeepkumar(dot)Pyatalo(at)honeywell(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: [SQL] how to cast localtimestamp to bigint???
Date: 2004-08-12 16:58:08
Message-ID: 411BA1A0.8010206@onesystem.com (view raw or flat)
Thread:
Lists: pgsql-novicepgsql-sql
I would have expected

SELECT current_timestamp::abstime::bigint;

to have worked, but there is no conversion abstime -> bigint.

Instead use

SELECT current_timestamp::abstime::int::bigint;

The final cast to bigint is not strictly neccessary.

This all begs the question, though, of why you are using a bigint for 
createtime and not a timestamp?


Pradeepkumar, Pyatalo (IE10) wrote:
> Hi,
> 
> I am having a table something like this....
> 
> CREATE TABLE(PointId integer, PointName varchar(50),PointType integer,
> createtime bigint);
> 
> where createtime is the current timestamp when the tuple is inserted.
> 
> now how do I insert values into the above table. Is there a way to cast
> timestamp to bigint.
> Also can anyone suggest as to which date function to use -
> CURRENT_TIMESTAMP, LOCALTIMESTAMP, timeofday(), now....
> 
> 
> 
>>With Best Regards 
>>Pradeep Kumar P J 
>>
> 
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster

-- 
Edmund Bacon <ebacon(at)onesystem(dot)com>

In response to

pgsql-novice by date

Next:From: Josh BerkusDate: 2004-08-12 17:27:45
Subject: Re: stress testing and performance monitoring
Previous:From: ExpoShare.comDate: 2004-08-12 16:53:20
Subject: Re: Help with query

pgsql-sql by date

Next:From: Sebastian AlbrechtDate: 2004-08-12 16:59:23
Subject: Getting points from polygon
Previous:From: Devin WhalenDate: 2004-08-12 15:53:09
Subject: Re: Sending errors from psql to error file

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group