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

Поиск
Список
Период
Сортировка
От Edmund Bacon
Тема Re: [SQL] how to cast localtimestamp to bigint???
Дата
Msg-id 411BA1A0.8010206@onesystem.com
обсуждение исходный текст
Ответ на how to cast localtimestamp to bigint???  ("Pradeepkumar, Pyatalo (IE10)" <Pradeepkumar.Pyatalo@honeywell.com>)
Список 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 по дате отправления:

Предыдущее
От: Eduardo Vázquez Rodríguez
Дата:
Сообщение: Re: Query output
Следующее
От: Michal Lijowski
Дата:
Сообщение: Using pgaccess and xpg