Unstable timestamp binary representation?

From: Shachar Shemesh <psql(at)shemesh(dot)biz>
To: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Unstable timestamp binary representation?
Date: 2005-03-18 09:57:36
Message-ID: 423AA610.8080007@shemesh.biz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi all,

In the OLE DB code there is code for parsing timestamps received from
the server. This code behaves erratically. Upon further examination, I
found the following piece of code in Postgresql's "timestamp2tm":

> #ifdef HAVE_INT64_TIMESTAMP
> dt -= CTimeZone * INT64CONST(1000000);
> #else
> dt -= CTimeZone;
> #endif

In other words, it seems that I, as a client, needs to guess whether
postgres was compiled with or without "HAVE_INT64_TIMESTAMP". If it was,
what I am getting is a big-endian int64. If it was not, this is a double
that needs to be multiplied by 1000000.

In my tests, Potgresql 8 running on Windows uses "double", while
Postgresql 7.4 running on Debian Linux SID uses int64. Is there any way
I can remotely detect which is it?

Reading from the actual code, it seems each instance of postgres just
assumes that it was encoded in the same format as it was compiled with,
not stopping to ask what the other side was compiled with. Is this a bug
in postgres as well?

Shachar

--
Shachar Shemesh
Lingnu Open Source Consulting ltd.
Have you backed up today's work? http://www.lingnu.com/backup.html

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Neil Conway 2005-03-18 10:30:52 Re: read-only planner input
Previous Message Oliver Jowett 2005-03-18 08:14:59 Re: read-only planner input