Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id C146C64FCC9 for ; Mon, 13 Oct 2008 06:58:13 -0300 (ADT) Received: from postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 17080-02 for ; Mon, 13 Oct 2008 06:57:56 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from fabaglexfr.fabasoft.com (fabaglexfr.fabasoft.com [192.84.221.196]) by postgresql.org (Postfix) with ESMTP id 2648D64FC08 for ; Mon, 13 Oct 2008 06:57:54 -0300 (ADT) Received: from FABAMAIL.fabagl.fabasoft.com ([10.10.5.136]) by fabaglexfr.fabasoft.com with InterScan Messaging Security Suite; Mon, 13 Oct 2008 11:57:09 +0200 Received: from 192.168.121.105 ([192.168.121.105]) by FABAMAIL.fabagl.fabasoft.com ([10.10.5.135]) with Microsoft Exchange Server HTTP-DAV ;Mon, 13 Oct 2008 09:57:47 +0000 Received: from vie063 by FABAMAIL.fabagl.fabasoft.com; 13 Oct 2008 11:57:24 +0200 Subject: Re: Timestamp with libpq From: Jakob Lechner Reply-To: jakob.lechner@applstrudl.com To: Wilhansen Li Cc: pgsql-interfaces@postgresql.org In-Reply-To: References: <1223884381.3502.10.camel@vie063.fabagl.fabasoft.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Organization: appl.strudl Software GmbH Date: Mon, 13 Oct 2008 11:57:23 +0200 Message-Id: <1223891843.3502.33.camel@vie063.fabagl.fabasoft.com> Mime-Version: 1.0 X-Mailer: Evolution 2.8.0 (2.8.0-33.el5) X-imss-version: 2.051 X-imss-result: Passed X-imss-scores: Clean:99.90000 C:2 M:3 S:5 R:5 X-imss-settings: Baseline:2 C:3 M:2 S:3 R:4 (0.1500 0.1500) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=none X-Spam-Level: X-Archive-Number: 200810/5 X-Sequence-Number: 6806 Hello, Am Montag, den 13.10.2008, 17:32 +0800 schrieb Wilhansen Li: >=20 > Actually, I've done this before. And, uh, you can check out my blog > for details: >=20 >=20 > http://blogs.crammerz-inc.net/thunk/2007/05/09/grabbing_time_in_postgresq= l_using_libpq I think I've seen your blog before. Your solution is reasonable but unfortunately not feasible for me: I'm writing a simple generic interface for accessing databases and thus I need to cope with arbitrary SQL statements. As I posted before I want to execute the statement "select * from testtable" without any modifications and if there are timestamp coloumns in the result set I want to convert the timestamp values to unix time_t values. I just wonder why my conversion routine for the binary timestamps returned from a postgres server running on RHEL works while it's not for a SLES server. Apparently the same SQL statement executed by exactly the same libpq API calls produces different results for the two postgres servers, one running on RHEL and another on SLES. Both postgres servers basically have the same version (8.1.4). The program that executes the SQL statement runs on my workstation and either connects to my RHEL server or to my SLES machine. Can anybody figure out a reason for this behaviour? Best regards Jakob --=20 Jakob Lechner Research & Development appl.strudl Software GmbH Honauerstra=C3=9Fe 4 A-4020 Linz Tel.: [+43] (70) 60 61 62 Fax: [+43] (70) 60 61 62-609 E-Mail: jakob.lechner@applstrudl.com Web: http://www.applstrudl.com Handelsgericht Linz, FN 303988 t