Re: [SQL] how to cast localtimestamp to bigint??? - Mailing list pgsql-novice

From Edmund Bacon
Subject Re: [SQL] how to cast localtimestamp to bigint???
Date
Msg-id 411BA1A0.8010206@onesystem.com
Whole thread Raw
In response to how to cast localtimestamp to bigint???  ("Pradeepkumar, Pyatalo (IE10)" <Pradeepkumar.Pyatalo@honeywell.com>)
List pgsql-novice
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@onesystem.com>

pgsql-novice by date:

Previous
From: Eduardo Vázquez Rodríguez
Date:
Subject: Re: Query output
Next
From: Michal Lijowski
Date:
Subject: Using pgaccess and xpg