Re: Platform dependency in timestamp parsing

Поиск
Список
Период
Сортировка
От Thomas Lockhart
Тема Re: Platform dependency in timestamp parsing
Дата
Msg-id 3BD0BEB9.3A9E9E7A@fourpalms.org
обсуждение исходный текст
Ответ на Platform dependency in timestamp parsing  (Tom Lane <tgl@sss.pgh.pa.us>)
Список 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


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Platform dependency in timestamp parsing
Следующее
От: Bill Studenmund
Дата:
Сообщение: Re: schema support, was Package support for Postgres