Re: Finding bogus dates - Mailing list pgsql-general

From A. Kretschmer
Subject Re: Finding bogus dates
Date
Msg-id 20070118193823.GA16764@a-kretschmer.de
Whole thread Raw
In response to Finding bogus dates  (Scott Ribe <scott_ribe@killerbytes.com>)
List pgsql-general
am  Thu, dem 18.01.2007, um 11:26:03 -0700 mailte Scott Ribe folgendes:
> 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...

You can write a function for this, read this chapter in the docu about
trapping errors:

http://www.postgresql.org/docs/8.2/interactive/plpgsql-control-structures.html#PLPGSQL-ERROR-TRAPPING



Andreas
--
Andreas Kretschmer
Kontakt:  Heynitz: 035242/47150,   D1: 0160/7141639 (mehr: -> Header)
GnuPG-ID:   0x3FFF606C, privat 0x7F4584DA   http://wwwkeys.de.pgp.net

pgsql-general by date:

Previous
From: Jeff Amiel
Date:
Subject: Re: drive failre, corrupt data...
Next
From: "Brandon Aiken"
Date:
Subject: Re: Finding bogus dates