Thread

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

    Herouth Maoz <herouth@oumail.openu.ac.il> — 1999-08-18T14:08:11Z

    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