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

From: Herouth Maoz <herouth(at)oumail(dot)openu(dot)ac(dot)il>
To: jim(at)reptiles(dot)org (Jim Mercer)
Cc: pgsql-general(at)postgreSQL(dot)org
Subject: Re: [GENERAL] Re: [HACKERS] getting at the actual int4 value of an abstime
Date: 1999-08-18 14:08:11
Message-ID: l03130300b3e06d36a29d@[147.233.159.109]
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

At 16:33 +0300 on 18/08/1999, Jim Mercer wrote:

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

Yes, but if someday someone decides that dates should be represented in
another way, this will break, and date_part( 'epoch', timefield ) will
always return the seconds since epoch. Data encapsulation thingie.

> also, is there a reverse to this?
>
> ie. how does one inject unix time_t data into an abstime field.

Into a datetime, simply use datetime( n ). To an abstime, add an abstime()
around the former. Don't try abstime( n ) - at least it doesn't work in 6.4.

> 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');"

copy is more efficient that a bunch of inserts, mind you.

Herouth

--
Herouth Maoz, Internet developer.
Open University of Israel - Telem project
http://telem.openu.ac.il/~herutma

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Bruce Tong 1999-08-18 14:14:49 CVS Import/Export
Previous Message Jim Mercer 1999-08-18 13:33:42 Re: [HACKERS] getting at the actual int4 value of an abstime

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Tong 1999-08-18 14:14:49 CVS Import/Export
Previous Message Tom Lane 1999-08-18 14:02:42 Re: [HACKERS] vacuum process size