Re: A creepy story about dates. How to prevent it?

From: nolan(at)celery(dot)tssi(dot)com
To: tgl(at)sss(dot)pgh(dot)pa(dot)us (Tom Lane)
Cc: pmh(at)edison(dot)ioppublishing(dot)com (Peter Haworth), scott(dot)marlowe(at)ihs(dot)com (scott(dot)marlowe), cmarin(at)dims(dot)com, pgsql-general(at)postgresql(dot)org (\"Pgsql-General-post E-mail\")
Subject: Re: A creepy story about dates. How to prevent it?
Date: 2003-06-19 16:50:04
Message-ID: 20030619165030.31618.qmail@celery.tssi.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> nolan(at)celery(dot)tssi(dot)com writes:
> >> Anyone care to run some tests to see how lax Oracle's to_date is?
>
> > Oracle's to_date function is not lax at all.
>
> Then we need to fix ours. Karel?

To make it as strict as Oracle's? I'm not entirely convinced that is a
Good Thing.

However, if that is to be done, would it also be possible to define a
'check_date' function which does the same as 'to_date' but returns NULL
(or some kind of error code) rather than a SQL error on an invalid date?

I've never tried it (and am somewhat embarassed to say that I had not
even considered the idea until today), but it should possible in Oracle's
PL/SQL to use exception handling to trap to_date errors. (I always
wound up using oraperl's error handling capabilities to detect bad
dates when porting data to Oracle.)

Would that be possible in pgplsql, does it support the same levels of
exception handling as PL/SQL?
--
Mike Nolan

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Andrew Ayers 2003-06-19 17:20:12 Re: Performance differences using varchar, char and text
Previous Message Ron Johnson 2003-06-19 16:43:41 Re: A creepy story about dates. How to prevent it?