Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ju3hx-0003Iq-3k for pgsql-general@arkaria.postgresql.org; Sat, 11 Jul 2020 00:49:37 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1ju3hw-00075L-22 for pgsql-general@arkaria.postgresql.org; Sat, 11 Jul 2020 00:49:36 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ju3hv-00075E-Qn for pgsql-general@lists.postgresql.org; Sat, 11 Jul 2020 00:49:35 +0000 Received: from mail-pf1-x442.google.com ([2607:f8b0:4864:20::442]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1ju3hp-0000oe-4i for pgsql-general@lists.postgresql.org; Sat, 11 Jul 2020 00:49:35 +0000 Received: by mail-pf1-x442.google.com with SMTP id t11so3247604pfq.11 for ; Fri, 10 Jul 2020 17:49:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=references:user-agent:from:to:subject:in-reply-to:message-id:date :mime-version; bh=zQbyzAaxo8CNtlKS4/7+3xkIcOh8yPxthOmGUzWnidg=; b=JynoDxwpV0F0eYm0MF5rU1CqWbGFWYVSIm8+oAvV92LtoDCVUv00Ue0vKhnEDJCK73 66oDZjp2y0bLtV1VuBBLtxm4r4W8qaTXNDmdAi+epWE1rBLhHyQqVvCC9uLx7zFxfP2s z7mAvgXeDVkwAQGBOEeftQUMfQ8OToLRwdCPJZ+xdamRx3HrcZD1t0OsLBhM4ZsjbCa5 G2TmtJ0JMW9D8vsgjWbJX4AdgAQQUscltCJVN8KQC9/5CTJPIUjMvCUDwXzvlOOiltMQ pvphI/7bYuo5q+krJ/lbL0HucR2fE5xkzbR8Jwe0VoqaCri3PmwTyygssDbtWDTrrQEs b3oA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:references:user-agent:from:to:subject :in-reply-to:message-id:date:mime-version; bh=zQbyzAaxo8CNtlKS4/7+3xkIcOh8yPxthOmGUzWnidg=; b=R5xHM2jKVTtorGGCbkA1z2KdJQJ/3eJs0NureCSM/qIIIp3Ip9bTDAuFo/mFPkHlAY YSj3ZUQpeqkPNMNtM9Sq/jzKkr617I96VJ8xWD5ngIDEM1Ja7JtC2JiDRRW6fQxekI+3 bqlJXzYyqnCGehFEru3Im/RX6gG82GYJIjmKcRO/6Qiz/7UISlEt3cVN5qGy3eWGdnIe bH7CNCMOpMN6vMHT3p5fwuQis86cKtU9ISqezOOLdmEeNCeLmIBaBEi8Ve6R7Wp86J2c KIeyENdFceBQm3EqxGYdrGq/4OAUGDZ10F6n4fd0/oIt0tEbLtfUYzswdJk3l7VYkfZI 9NnA== X-Gm-Message-State: AOAM531FpAnNMZzVTmLK7JuKWt03ewsWp7PJWDqXymnBamU1WFPO2pnW Ej/NYIS4k2n8yHKsX+SLwn+acHn2 X-Google-Smtp-Source: ABdhPJwDbPLUuaJGHdjNStT/ZS7JwQECWZjw+5wPdu6FtN3e/ja0aRZWXqifBLnp1cdhJZXBtg/EqQ== X-Received: by 2002:a62:27c4:: with SMTP id n187mr30273146pfn.208.1594428567054; Fri, 10 Jul 2020 17:49:27 -0700 (PDT) Received: from tim-desktop (203-173-27-16.dyn.iinet.net.au. [203.173.27.16]) by smtp.gmail.com with ESMTPSA id b21sm7079960pfp.172.2020.07.10.17.49.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jul 2020 17:49:26 -0700 (PDT) References: User-agent: mu4e 1.5.4; emacs 27.0.91 From: Tim Cross To: pgsql-general@lists.postgresql.org Subject: Re: Issue with timestamp without time zone datatype with default value as now()/localtimestamp In-reply-to: Message-ID: <871rlikh9p.fsf@gmail.com> Date: Sat, 11 Jul 2020 10:49:22 +1000 MIME-Version: 1.0 Content-Type: text/plain List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Deepika S Gowda writes: > Hi, > > On postgres 11.7 Master/Slave node, there is column named "createddate" > with datatype "timestamp without time zone" with default value as "now()"; > > Column Name | Date Type | Default value > createddate |timestamp without time zone|Now() > > > Issue: From the java application , data is getting loaded into this table > where we expect column value should be today's date with timestamp( > "2020-07-10 10:56:43.21"). But, out of 3K records, 100 records are loaded > as "2019-07-10 10:56:43.21" (change in Year). > > What could be the issue? we tried changing the default value to > "localtimestamp". > My bet would be you have some SQL statements which include a value for 'createddate', so the default is not being used. -- Tim Cross