Re: BUG #15145: date time default value issues

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: BUG #15145: date time default value issues
Дата
Msg-id 1546.1523110458@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: BUG #15145: date time default value issues  ("David G. Johnston" <david.g.johnston@gmail.com>)
Список pgsql-bugs
"David G. Johnston" <david.g.johnston@gmail.com> writes:
> On Friday, April 6, 2018, PG Bug reporting form <noreply@postgresql.org>
> wrote:
>> i set column "document_datenow timestamp with time zone NOT NULL DEFAULT
>> now()"
>> but the values that like this "0001-12-31 23:42:04+06:42:04 BC"

> This is so unusual I don't know really where to start.

Poking about in the tz database, I notice that +06:42:04 is the UTC offset
shown for Asia/Bangkok before 1920 (ie, before adoption of a standard time
zone offset).  So, if the database's time zone were set to Asia/Bangkok
and then you put in a time around the start of the common era:

regression=# set timezone = 'Asia/Bangkok';
SET
regression=# select '0001-12-31 17:00 UTC BC'::timestamptz;
           timestamptz           
---------------------------------
 0001-12-31 23:42:04+06:42:04 BC
(1 row)

Now this just moves the mystery to another place: how'd that value get
entered?  I'd speculate about perhaps using to_timestamp() with a wrong
format string, causing what should have been year 2001 to be read as 0001,
or something like that.  The OP hasn't shown us what he did to enter this
value, so it's all speculation.  The table definition is nigh irrelevant,
though :-(

            regards, tom lane


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

Предыдущее
От: Marko Tiikkaja
Дата:
Сообщение: Re: BUG #15145: date time default value issues
Следующее
От: Tom Lane
Дата:
Сообщение: Re: BUG #14999: pg_rewind corrupts control file global/pg_control