From: Tom Lane <tgl@sss.pgh.pa.us>
To: David G. Johnston <david.g.johnston@gmail.com>
Cc: dibxyooj96@gmail.com <dibxyooj96@gmail.com>
Cc: pgsql-bugs@lists.postgresql.org <pgsql-bugs@lists.postgresql.org>
Subject: Re: BUG #15145: date time default value issues
Date: Sat, 07 Apr 2018 10:14:18 -0400
Message-ID: <1546.1523110458@sss.pgh.pa.us> (raw)
In-Reply-To: <CAKFQuwbrUU7ned2_KGfx3vnK5tP_vTcijjtK7qnbDJyJQ7UyJg@mail.gmail.com>
References: <152307492321.31235.14671498918810431529@wrigleys.postgresql.org>
<CAKFQuwbrUU7ned2_KGfx3vnK5tP_vTcijjtK7qnbDJyJQ7UyJg@mail.gmail.com>
"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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: tgl@sss.pgh.pa.us, david.g.johnston@gmail.com, dibxyooj96@gmail.com
Subject: Re: BUG #15145: date time default value issues
In-Reply-To: <1546.1523110458@sss.pgh.pa.us>
References: <152307492321.31235.14671498918810431529@wrigleys.postgresql.org> <CAKFQuwbrUU7ned2_KGfx3vnK5tP_vTcijjtK7qnbDJyJQ7UyJg@mail.gmail.com> <1546.1523110458@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox