Re:Re: Re: [BUGS] Return value error of‘to_timestamp’

From: 甄明洋 <zhenmingyang(at)yeah(dot)net>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: "Aleksander Alekseev" <a(dot)alekseev(at)postgrespro(dot)ru>, pgsql-bugs <pgsql-bugs(at)postgresql(dot)org>
Subject: Re:Re: Re: [BUGS] Return value error of‘to_timestamp’
Date: 2016-08-17 11:06:14
Message-ID: 6144af7f.1d1e.156982e1e21.Coremail.zhenmingyang@yeah.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Thank you very much !

I have another question for datetime type, it is GUC parameter 'timezone' , example as follow:

postgres=# set timezone='-08:00';
SET
postgres=# show timezone;
TimeZone
----------
-08:00
(1 row)

postgres=# select timestamptz'1990-1-1 11:11:11.123 -08:00' ;
timestamptz
----------------------------
1990-01-02 03:11:11.123+08
(1 row)

postgres=# select timestamptz'1990-1-1 11:11:11.123 +08:00' ;
timestamptz
----------------------------
1990-01-01 11:11:11.123+08
(1 row)

postgres=#

this looks like, the sign plus and minus are inverted, i dont understand why?

在 2016-08-04 23:06:40,"David G. Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> 写道:

On Thu, Aug 4, 2016 at 11:03 AM, Aleksander Alekseev <a(dot)alekseev(at)postgrespro(dot)ru> wrote:

>> postgres=# select to_timestamp('1990-1-1 11:11:11.123456789',
>> 'YYYY-MM-DD HH24:MI:SS.US'); to_timestamp
>> -------------------------------
>> 1990-01-01 11:13:14.456789+08
>> (1 row)
>> postgres=#

> Working as designed...

Maybe it means that current design is poor. However since this behavior
is documented there are users who might depend on it. So I doubt it
will be changed any time soon.

Though I wonder maybe we should consider introducing a new set of
time-related procedures with different behavior (to_timestamp_strict?),
that would be more obvious to users.

Discussions ongoing...
an archive search should be fruitful.

David J.

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Michael Paquier 2016-08-17 11:09:33 Re: jsonb_array_elements issue
Previous Message Magnus Hagander 2016-08-17 10:19:31 Re: BUG #14243: pg_basebackup failes by a STATUS_DELETE_PENDING file