Re: Junk date getting uploaded into date field

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: bsreejithin <bsreejithin(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Junk date getting uploaded into date field
Date: 2013-11-05 15:03:56
Message-ID: 16999.1383663836@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

bsreejithin <bsreejithin(at)gmail(dot)com> writes:
> I am not sure why : select to_date('33-OCT-2013', 'dd-mon-yyyy')
> is returning 2013-11-02.
> For cases like the issue I am facing, where we need to raise an error saying
> the data is wrong, DB manipulating the data is not proper.

Then don't use to_date(). Just entering the string through the normal date
type input function will do what you want. to_date() is meant for trying
to extract data from weird input formats.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Jing Fan 2013-11-05 15:07:38 Re: WITH RECURSIVE doesn't work properly for me
Previous Message Albe Laurenz 2013-11-05 14:52:49 Re: WITH RECURSIVE doesn't work properly for me