Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VFe6q-0008NG-22 for pgsql-admin@arkaria.postgresql.org; Sat, 31 Aug 2013 05:52:32 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1VFe6p-0001Vk-DB for pgsql-admin@arkaria.postgresql.org; Sat, 31 Aug 2013 05:52:31 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VFe6o-0001Ve-Jm for pgsql-admin@postgresql.org; Sat, 31 Aug 2013 05:52:30 +0000 Received: from smtpout5.laposte.net ([193.253.67.230] helo=smtpout.laposte.net) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VFe6l-0005E2-Oi for pgsql-admin@postgresql.org; Sat, 31 Aug 2013 05:52:30 +0000 Received: from [192.168.66.1] ([89.158.80.195]) by mwinf8510-out with ME id KHsQ1m00A4CqZUx03HsRj5; Sat, 31 Aug 2013 07:52:25 +0200 Message-ID: <52218498.6020302@laposte.net> Date: Sat, 31 Aug 2013 07:52:24 +0200 From: =?ISO-8859-1?Q?fran=E7ois_Figarola?= User-Agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130803 Thunderbird/17.0.8 MIME-Version: 1.0 To: pgsql-admin@postgresql.org Subject: Re: to_timestamp error between postgres version 8.3 and 9.2 References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Pg-Spam-Score: -4.4 (----) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-admin Precedence: bulk Sender: pgsql-admin-owner@postgresql.org I think it's only a syntax problem : to_timestamp('null','yyyy-MM-ddhh24:mi:ss')::TIMESTAMP In this form your 'null' parameter is a text which dont match for your definition, so the function is waiting for an integer representing the year and fails. But if you write : to_timestamp(null,'yyyy-MM-ddhh24:mi:ss')::TIMESTAMP the function return a NULL value. Hope it helps. Le 31/08/2013 07:19, Technical Doubts a écrit : > > Dear Team, > > I have a table with name registers_info with below columns > > regid character varying, > transid bigint, > regdate timestamp without time zone, > canceldate timestamp without time zone > > > insert into registers_info (regid,transid,regdate,canceldate) values > ('reg1',1,to_timestamp('2013-07-24','yyyy-MM-dd > hh24:mi:ss')::TIMESTAMP,to_timestamp('null','yyyy-MM-dd > hh24:mi:ss')::TIMESTAMP); > > The above query works fine in Postgres 8.3 version. > > But the same query when executed in postgres 9.2 its throwing below error > > ERROR: invalid value "null" for "yyyy" > Detail: Value must be an integer. > > From application, this cancel date might have values or it may come as null. > > Kindly suggest. Thanks in advance. > > > -- > John -- Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-admin