pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: françois Figarola <francois.figarola@laposte.net>
To: pgsql-admin@postgresql.org
Subject: Re: to_timestamp error between postgres version 8.3 and 9.2
Date: Sat, 31 Aug 2013 07:52:24 +0200
Message-ID: <52218498.6020302@laposte.net> (raw)
In-Reply-To: <CAJyuQsEP6af-MzxS=utG_4AN9ziHyDEOLSmecTiRt-fD7i+jCg@mail.gmail.com>
References: <CAJyuQsEP6af-MzxS=utG_4AN9ziHyDEOLSmecTiRt-fD7i+jCg@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-admin>

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



view thread (3+ messages)

Message-ID: <52218498.6020302@laposte.net>
Permalink:  ../52218498.6020302@laposte.net/
Also on:    postgresql.org/message-id/52218498.6020302@laposte.net

 · 

reply

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 using the --to and --cc options:
  reply via email

  To: pgsql-admin@postgresql.org
  Cc: francois.figarola@laposte.net
  Subject: Re: to_timestamp error between postgres version 8.3 and 9.2
  In-Reply-To: <52218498.6020302@laposte.net>

* 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