Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1f4obo-0001pv-GO for pgsql-bugs@arkaria.postgresql.org; Sat, 07 Apr 2018 14:14:24 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1f4obn-0004IE-7I for pgsql-bugs@arkaria.postgresql.org; Sat, 07 Apr 2018 14:14:23 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1f4obm-0004I5-UA for pgsql-bugs@lists.postgresql.org; Sat, 07 Apr 2018 14:14:23 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1f4obk-0004ke-HS for pgsql-bugs@lists.postgresql.org; Sat, 07 Apr 2018 14:14:21 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id w37EEIZe001547; Sat, 7 Apr 2018 10:14:18 -0400 From: Tom Lane To: "David G. Johnston" cc: "dibxyooj96@gmail.com" , "pgsql-bugs@lists.postgresql.org" Subject: Re: BUG #15145: date time default value issues In-reply-to: References: <152307492321.31235.14671498918810431529@wrigleys.postgresql.org> Comments: In-reply-to "David G. Johnston" message dated "Fri, 06 Apr 2018 22:29:31 -0700" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1545.1523110458.1@sss.pgh.pa.us> Date: Sat, 07 Apr 2018 10:14:18 -0400 Message-ID: <1546.1523110458@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk "David G. Johnston" writes: > On Friday, April 6, 2018, PG Bug reporting form > 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