Re: Platform dependency in timestamp parsing

From: Thomas Lockhart <lockhart(at)fourpalms(dot)org>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: Platform dependency in timestamp parsing
Date: 2001-10-20 00:00:57
Message-ID: 3BD0BEB9.3A9E9E7A@fourpalms.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> Using current sources, the following sequence:
> set DateStyle TO 'Postgres';
> set TimeZone TO 'PST8PDT';
> select '2001-09-22T18:19:20'::timestamp(2);
> produces... (snip) ...
> on my HPUX box, and evidently also on your machine because that's
> what's in the timestamptz expected file. However, on a LinuxPPC
> machine I get ... (snip) ...
> ie, the value after 'T' is interpreted as local time not GMT time.
> Question 1: which behavior is correct per spec? I'd have expected
> local time myself, but I'm not sure where this is specified.

It should be local time.

> Question 2: where to look for the reason for the difference in the
> code? I'm a tad surprised that the HP box behaves more like
> yours does than the LinuxPPC box ...

Me too :)

It is a one line fix in datetime.c, on or about line 918. It needs a
"tmask = 0;" for the new DTK_ISO_TIME case so that the "feature bitmask"
is not altered by the "T" in the string. When it is altered, it thinks
that a time zone was already specified, so does not try to determine
one.

Before:

thomas=# select timestamp '2001-10-19T16:47';
------------------------
2001-10-19 09:47:00-07

After:

thomas=# select timestamp '2001-10-19T16:47';
------------------------
2001-10-19 16:47:00-07

I have patches...

- Thomas

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Thomas Lockhart 2001-10-20 01:06:18 Re: Detecting glibc getopt?
Previous Message Johann Zuschlag 2001-10-19 22:41:11 Error while restoring database