X-Original-To: pgsql-interfaces-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 12E72DA1C9 for ; Sat, 15 Oct 2005 00:09:36 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 19835-07 for ; Sat, 15 Oct 2005 03:09:33 +0000 (GMT) Received: from tigger.fuhr.org (tigger.fuhr.org [63.214.45.158]) by svr1.postgresql.org (Postfix) with ESMTP id ED2AFDA1C6 for ; Sat, 15 Oct 2005 00:09:32 -0300 (ADT) Received: from winnie.fuhr.org (winnie.fuhr.org [10.1.0.1]) by tigger.fuhr.org (8.13.3/8.13.3) with ESMTP id j9F39Rse088118 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 14 Oct 2005 21:09:29 -0600 (MDT) (envelope-from mfuhr@winnie.fuhr.org) Received: from winnie.fuhr.org (localhost [127.0.0.1]) by winnie.fuhr.org (8.13.4/8.13.4) with ESMTP id j9F39Qve022226; Fri, 14 Oct 2005 21:09:26 -0600 (MDT) (envelope-from mfuhr@winnie.fuhr.org) Received: (from mfuhr@localhost) by winnie.fuhr.org (8.13.4/8.13.4/Submit) id j9F39QBq022225; Fri, 14 Oct 2005 21:09:26 -0600 (MDT) (envelope-from mfuhr) Date: Fri, 14 Oct 2005 21:09:26 -0600 From: Michael Fuhr To: Tom Lane Cc: H Hale , pgsql-interfaces@postgresql.org Subject: Re: [GENERAL] binary timestamp conversion Message-ID: <20051015030926.GA22137@winnie.fuhr.org> References: <20051014200002.89011.qmail@web52315.mail.yahoo.com> <7448.1129323875@sss.pgh.pa.us> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <7448.1129323875@sss.pgh.pa.us> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.006 required=5 tests=[AWL=0.006] X-Spam-Level: X-Archive-Number: 200510/16 X-Sequence-Number: 5778 On Fri, Oct 14, 2005 at 05:04:35PM -0400, Tom Lane wrote: > H Hale writes: > > I save 1970-01-01 00:00:00 and read it back expecting > > the difference between postgres and unix epochs but > > get different results each time. > > > (After conversion to host byte order). > > Sounds to me like you're picking up garbage rather than the data you > should. Dunno if this is significant, but the garbage appears to be confined to the lower 32 bits, at least in the three examples given: test=> select val, to_hex(val) from foo; val | to_hex ------------------+------------------ -946686612744257 | fffca2fe58bbd7bf -946684195712577 | fffca2fee8ccd1bf -946684196834881 | fffca2fee8bbb1bf > Does your code to fetch the binary value produce correct answers > on an ordinary int8 column? Could we see the code? A minimal but complete program that somebody else could compile and run might be revealing. -- Michael Fuhr