[GENERAL] funkiness with '1999-12-31 19:00:00-05'::timestamp with time zone

2010-09-03 Thread Josh Kupershmidt
Hi all, I've come across a puzzling situation with a table having a timestamp with time zone column. This column is full of values displaying exactly as '1999-12-31 19:00:00-05', but for some reason Postgres is treating some of these identical-seeming timestamps as being different. If I update

Re: [GENERAL] funkiness with '1999-12-31 19:00:00-05'::timestamp with time zone

2010-09-03 Thread Tom Lane
Josh Kupershmidt schmi...@gmail.com writes: I've come across a puzzling situation with a table having a timestamp with time zone column. This column is full of values displaying exactly as '1999-12-31 19:00:00-05', but for some reason Postgres is treating some of these identical-seeming

Re: [GENERAL] funkiness with '1999-12-31 19:00:00-05'::timestamp with time zone

2010-09-03 Thread Josh Kupershmidt
On Fri, Sep 3, 2010 at 2:58 PM, Tom Lane t...@sss.pgh.pa.us wrote: Is this installation using float or integer timestamps?  If the former, it might be interesting to look at the subtraction result        ts - '1999-12-31 19:00:00-05'::timestamptz I'm thinking some of them might be different by

Re: [GENERAL] funkiness with '1999-12-31 19:00:00-05'::timestamp with time zone

2010-09-03 Thread Tom Lane
Josh Kupershmidt schmi...@gmail.com writes: On Fri, Sep 3, 2010 at 2:58 PM, Tom Lane t...@sss.pgh.pa.us wrote: I'm thinking some of them might be different by submicrosecond amounts. Ah yes, this is likely why. pg_config says CONFIGURE = ... '--disable-integer-datetimes' ... But I'm having

Re: [GENERAL] funkiness with '1999-12-31 19:00:00-05'::timestamp with time zone

2010-09-03 Thread Josh Kupershmidt
On Fri, Sep 3, 2010 at 3:24 PM, Tom Lane t...@sss.pgh.pa.us wrote: regression=# select extract(epoch from ts - '1999-12-31 19:00:00-05'::timestamptz) from t1;      date_part --  1.0761449337e-07                    0 (2 rows) This timestamp (2000-01-01 00:00 GMT)

Re: [GENERAL] funkiness with '1999-12-31 19:00:00-05'::timestamp with time zone

2010-09-03 Thread Tom Lane
[ trivia warning ] I wrote: We don't make any great effort to expose that though. It looks like the closest value that timestamptzin makes different from zero is regression=# select extract(epoch from '1999-12-31 19:00:00.001-05' - '1999-12-31 19:00:00-05'::timestamptz) ;

Re: [GENERAL] funkiness with '1999-12-31 19:00:00-05'::timestamp with time zone

2010-09-03 Thread Tom Lane
Josh Kupershmidt schmi...@gmail.com writes: EXTRACT(epoch ...) was what I was looking for: SELECT EXTRACT(epoch FROM ts - '1999-12-31 19:00:00-05'::timestamptz) FROM timestamps_test LIMIT 5; date_part --- 1.4120666068199e-309 1.4154982781624e-309

Re: [GENERAL] funkiness with '1999-12-31 19:00:00-05'::timestamp with time zone

2010-09-03 Thread Josh Kupershmidt
On Fri, Sep 3, 2010 at 3:40 PM, Tom Lane t...@sss.pgh.pa.us wrote: Wow.  You must have gotten those with the help of some arithmetic, because timestamptzin would never have produced them.  I found out I can do regression=# select extract(epoch from ('2000-01-01 00:00:00'::timestamptz +

Re: [GENERAL] funkiness with '1999-12-31 19:00:00-05'::timestamp with time zone

2010-09-03 Thread Tom Lane
Josh Kupershmidt schmi...@gmail.com writes: On Fri, Sep 3, 2010 at 3:40 PM, Tom Lane t...@sss.pgh.pa.us wrote: but I wonder what it was you actually did. I wonder myself :-) I encountered these timestamps while going through some C code I inherited which uses libpq to load several tables

Re: [GENERAL] funkiness with '1999-12-31 19:00:00-05'::timestamp with time zone

2010-09-03 Thread Josh Kupershmidt
On Fri, Sep 3, 2010 at 4:01 PM, Tom Lane t...@sss.pgh.pa.us wrote: Interesting.  I can't imagine how you could have produced these with plain COPY, since that would go through timestamptzin.  Was it by any chance a binary COPY?  If so I could believe that funny timestamps could get in.  Maybe

Re: [GENERAL] funkiness with '1999-12-31 19:00:00-05'::timestamp with time zone

2010-09-03 Thread Tom Lane
Josh Kupershmidt schmi...@gmail.com writes: On Fri, Sep 3, 2010 at 4:01 PM, Tom Lane t...@sss.pgh.pa.us wrote: Interesting.  I can't imagine how you could have produced these with plain COPY, since that would go through timestamptzin.  Was it by any chance a binary COPY?  If so I could believe