Re: Finding bogus dates

From: Adam Rich <adam(dot)r(at)sbcglobal(dot)net>
To: Scott Ribe <scott_ribe(at)killerbytes(dot)com>, "pgsql-general postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Finding bogus dates
Date: 2007-01-18 18:52:13
Message-ID: 20070118185213.87697.qmail@web81415.mail.mud.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I suppose you could create a boolean function that does a cast, and catches the
execption, returning NULL.

If that doesn't work, a perl stored procedure using Date::Calc and check_date() ?

----- Original Message ----
From: Scott Ribe <scott_ribe(at)killerbytes(dot)com>
To: pgsql-general postgresql.org <pgsql-general(at)postgresql(dot)org>
Sent: Thursday, January 18, 2007 12:26:03 PM
Subject: [GENERAL] Finding bogus dates

Suppose that I have a varchar column which contains dates, and some of them
are bogus, such as '1968-02-31'. Is it possible to specify a query condition
"cannot be cast to a valid date". (It's legacy data, and I'm trying to clean
it up before importing into the final schema.) There probably aren't that
many, and I can just keep hitting pg errors one row at a time until I work
through this, but...

--
Scott Ribe
scott_ribe(at)killerbytes(dot)com
http://www.killerbytes.com/
(303) 722-0567 voice

---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo(at)postgresql(dot)org so that your
message can get through to the mailing list cleanly

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tomas Vondra 2007-01-18 19:06:10 Re: Finding bogus dates
Previous Message Arindam 2007-01-18 18:48:58 pg_passwd alternative in Postgres 8.1.5