Re: Finding bogus dates
От
Tomas Vondra
Тема
Re: Finding bogus dates
Дата
Msg-id
45AFC522.7010803@fuzzy.cz
Ответ на
Finding bogus dates (Scott Ribe)
Список
Дерево обсуждения
Finding bogus dates Scott Ribe <scott_ribe@killerbytes.com>
Re: Finding bogus dates "A. Kretschmer" <andreas.kretschmer@schollglas.com>
Re: Finding bogus dates Tomas Vondra <tv@fuzzy.cz>
Re: Finding bogus dates "Brandon Aiken" <BAiken@winemantech.com>
Re: Finding bogus dates Scott Ribe <scott_ribe@killerbytes.com>
Re: Finding bogus dates "Brandon Aiken" <BAiken@winemantech.com>
Re: Finding bogus dates Scott Ribe <scott_ribe@killerbytes.com>
Re: Finding bogus dates "John D. Burger" <john@mitre.org>
Re: Finding bogus dates Scott Ribe <scott_ribe@killerbytes.com>
PG not rejecting bad dates (was Re: Finding bogus dates) Ron Johnson <ron.l.johnson@cox.net>
Re: PG not rejecting bad dates (was Re: Finding bogus dates) David Fetter <david@fetter.org>
Re: PG not rejecting bad dates (was Re: Finding bogus dates) Ron Johnson <ron.l.johnson@cox.net>
Re: PG not rejecting bad dates (was Re: Finding bogus dates) David Fetter <david@fetter.org>
Re: PG not rejecting bad dates (was Re: Finding bogus Scott Ribe <scott_ribe@killerbytes.com>
Re: PG not rejecting bad dates (was Re: Finding bogus dates) "Chad Wagner" <chad.wagner@gmail.com>
> 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...
I guess you can use something like this procedure:
create or replace function is_date(d varchar) returns boolean as $$
declare
tmp date;
begin
tmp := d::date;
return true;
exception
when others then
return false;
end;
$$ language plpgsql;
В списке pgsql-general по дате отправления