IsDate function in plpgsql

From: "Sistemas C(dot)M(dot)P(dot)" <sistemascmp(at)redynet4(dot)com(dot)ar>
To: <pgsql-admin(at)postgresql(dot)org>
Subject: IsDate function in plpgsql
Date: 2006-04-27 14:34:42
Message-ID: 006501c66a07$b8c08d60$0501a8c0@pcsistemas
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

A few days ago, someone in this list gives me a function (plpgsql) that evaluates if a string is a valid date or not.
It returns 1 or 0 (valid/Not Valid)
The problem is that if the argument is a NULL field the function returns 1.
I don't have experience with plpgsql language.
This is the function

begin
perform $1::date;
return 1;
exception when others then
return 0;
end

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Ketema Harris 2006-04-27 14:38:56 Re: IsDate function in plpgsql
Previous Message David Levy 2006-04-27 12:06:24 Re: pg_restore index/trigger restoration issue