pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Edmund Bacon <ebacon@onesystem.com>
To: Pradeepkumar, Pyatalo (IE10) <Pradeepkumar.Pyatalo@honeywell.com>
Cc: pgsql-novice@postgresql.org
Subject: Re: [SQL] how to cast localtimestamp to bigint???
Date: Thu, 12 Aug 2004 10:58:08 -0600
Message-ID: <411BA1A0.8010206@onesystem.com> (raw)
In-Reply-To: <77ED2BF75D59D1439F90412CC5B109741027FF0F@ie10-sahara.hiso.honeywell.com>
References: <77ED2BF75D59D1439F90412CC5B109741027FF0F@ie10-sahara.hiso.honeywell.com>

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>



view thread (4+ messages)  latest in thread

Message-ID: <411BA1A0.8010206@onesystem.com>
Permalink:  ../411BA1A0.8010206@onesystem.com/
Also on:    postgresql.org/message-id/411BA1A0.8010206@onesystem.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: ebacon@onesystem.com, Pradeepkumar.Pyatalo@honeywell.com, pgsql-novice@postgresql.org
  Subject: Re: [SQL] how to cast localtimestamp to bigint???
  In-Reply-To: <411BA1A0.8010206@onesystem.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox