Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iycen-0000uS-DQ for pgsql-bugs@arkaria.postgresql.org; Mon, 03 Feb 2020 14:24:57 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iycem-0004nC-1u for pgsql-bugs@arkaria.postgresql.org; Mon, 03 Feb 2020 14:24:56 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iycel-0004n5-Q7 for pgsql-bugs@lists.postgresql.org; Mon, 03 Feb 2020 14:24:55 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1iycei-0000ZW-KU for pgsql-bugs@lists.postgresql.org; Mon, 03 Feb 2020 14:24:54 +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 013EOovK006200; Mon, 3 Feb 2020 09:24:50 -0500 From: Tom Lane To: borratejaabhi@gmail.com cc: pgsql-bugs@lists.postgresql.org Subject: Re: BUG #16240: The now() function is populating different date time than expected In-reply-to: <16240-81d13113beecf3cb@postgresql.org> References: <16240-81d13113beecf3cb@postgresql.org> Comments: In-reply-to PG Bug reporting form message dated "Mon, 03 Feb 2020 10:38:10 +0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <6198.1580739890.1@sss.pgh.pa.us> Date: Mon, 03 Feb 2020 09:24:50 -0500 Message-ID: <6199.1580739890@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk PG Bug reporting form writes: > We have certain columns in our database of data type 'timestamp with time > zone'. We are populating them with now() function as default value > .Sometimes the date time is getting populated as dates from 2017/18 > randomly. What can be the possible cause of this issue? The most likely bet is that something is issuing insert commands with non-default values in that column. now() itself does basically nothing except read the transaction start timestamp. If you were seeing lots of *other* weird time effects, like say timestamps in the postmaster log jumping all over the place, maybe it'd be possible to believe that there's something wrong with your server's system clock. But I'd start by looking more closely at your application's SQL logic. regards, tom lane