Re: [HACKERS] getting at the actual int4 value of an abstime

From: jim(at)reptiles(dot)org (Jim Mercer)
To: reedstrm(at)wallace(dot)ece(dot)rice(dot)edu (Ross J(dot) Reedstrom)
Cc: jim(at)reptiles(dot)org, pgsql-general(at)postgreSQL(dot)org, pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: [HACKERS] getting at the actual int4 value of an abstime
Date: 1999-08-18 13:33:42
Message-ID: m11H5qY-00080YC@mailbox.reptiles.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

> test=> select timefield::int8 from timetest;
> int8
> ---------
> 934931603
> 934931604
> 934931605
> (3 rows)

hmmm, as you did, i tried timefield::int4, and got the same results.
i hadn't tried timefield::int8.

i suspect this would be more efficient than date_part('epoch', timefield).

> What version of PostgreSQL, BTW? This is 6.5: int8 and numeric support got a
> lot better vs. 6.4

i am using 6.5, soon gonna upgrade to 6.5.1.

thanx, this will make my code much more efficient.

also, is there a reverse to this?

ie. how does one inject unix time_t data into an abstime field.

i currently pass my raw data through a filter, which converts it
to 'yyyy-mm-dd HH:MM:SS'.

then i bring it in using: "COPY tb USING STDIN;"

it would be nice if i could do a batch of:
"INSERT INTO tb (time_t, data1, date2) VALUES (934931604, 'aa', 'bb');"

--
[ Jim Mercer Reptilian Research jim(at)reptiles(dot)org +1 416 410-5633 ]
[ The telephone, for those of you who have forgotten, was a commonly used ]
[ communications technology in the days before electronic mail. ]
[ They're still easy to find in most large cities. -- Nathaniel Borenstein ]

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Herouth Maoz 1999-08-18 14:08:11 Re: [GENERAL] Re: [HACKERS] getting at the actual int4 value of an abstime
Previous Message Ansley, Michael 1999-08-18 10:36:39 Doc management software

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 1999-08-18 13:58:09 Re: [HACKERS] Re: [CORE] Re: tomorrow
Previous Message D'Arcy J.M. Cain 1999-08-18 12:01:10 Re: [HACKERS] Re: [CORE] Re: tomorrow