Re: Junk date getting uploaded into date field

From: Michael Nolan <htfoot(at)gmail(dot)com>
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:25:50
Message-ID: CAOzAquL9w1-4uzdGmDPfkRkQ0r+=KaLHmKh3QubWkggMUoKKmw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 11/5/13, bsreejithin <bsreejithin(at)gmail(dot)com> wrote:
>
> 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.

Try using a cast to date instead:

select '33-oct-2013'::date throws an error.
--
Mike Nolan

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Edson Richter 2013-11-05 15:26:37 Re: Curious question about physical files to store database
Previous Message Jing Fan 2013-11-05 15:07:38 Re: WITH RECURSIVE doesn't work properly for me