pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Jakob Lechner <jakob.lechner@applstrudl.com>
To: Michael Meskes <meskes@postgresql.org>
Cc: Wilhansen Li <willi.t1@gmail.com>
Cc: pgsql-interfaces@postgresql.org
Subject: Re: Timestamp with libpq
Date: Mon, 13 Oct 2008 14:34:02 +0200
Message-ID: <1223901242.3502.54.camel@vie063.fabagl.fabasoft.com> (raw)
In-Reply-To: <20081013104627.GA23971@feivel.credativ.de>
References: <1223884381.3502.10.camel@vie063.fabagl.fabasoft.com>
	<bc9549a50810130232nf40bfd2l2aee3c8c3ff5ec7e@mail.gmail.com>
	<1223891843.3502.33.camel@vie063.fabagl.fabasoft.com>
	<20081013104627.GA23971@feivel.credativ.de>

Hi Michael,

Am Montag, den 13.10.2008, 12:46 +0200 schrieb Michael Meskes:

> Please keep in mind that there is no guarantee that your server sends a double
> in a binary query. This depens on whether integer-datatypes are configure or
> not. Or in other words, it might be a long long instead of a double.

Yes, you're right. The SLES postgres server transmits timestamps as long
long numbers (microseconds since 2000-01-01).

> Is there any reason to use a binary transfer? 

If I use textual transfer I'm losing precision. E.g. for timestamps the
returned string from my table is "1955-06-08 00:00:00". Thus I'm
restricted to timestamps with a granularity of 1 second.

> I would not recommend this in a
> general setup. If you just want to avoid some ascii translation hassle, how
> about using ecpg instead of libpq?

The generic database interface I'm writing is part of a basic library
used in our project. The interface serves as an abstraction for
accessing different database servers (Postgres, MSSQL, ...). I'm
currently working on the postgres implementation of the interface. 
As far as I've seen using ecpg means to hardcode SQL statements which of
course can't be done in a generic library.

Thanks for your helpful hints. But it's seems I don't have much choice
but to use ascii transfer mode.

Best regards
Jakob

-- 
Jakob Lechner
Research & Development
appl.strudl Software GmbH
Honauerstraße 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



view thread (7+ messages)  latest in thread

Message-ID: <1223901242.3502.54.camel@vie063.fabagl.fabasoft.com>
Permalink:  ../1223901242.3502.54.camel@vie063.fabagl.fabasoft.com/
Also on:    postgresql.org/message-id/1223901242.3502.54.camel@vie063.fabagl.fabasoft.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-interfaces@postgresql.org
  Cc: jakob.lechner@applstrudl.com, meskes@postgresql.org, willi.t1@gmail.com
  Subject: Re: Timestamp with libpq
  In-Reply-To: <1223901242.3502.54.camel@vie063.fabagl.fabasoft.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox