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
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice pgsql-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

Browse pgsql-novice by date

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

Browse pgsql-sql by date

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