Function Like IsDate in pgSQL

Function Like IsDate in pgSQL

am 02.01.2006 16:22:30 von sistemascmp

This is a multi-part message in MIME format.

------=_NextPart_000_001D_01C60F97.338F5E70
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

I'm sorry. I'm from Argentina and my english is very poor.

I am converting an aplication from Ms-SQL to postgreSQL with ODBC.
I have a query that use the IsDate(string) function (Ms function). =
This function return true if the argument (string) is a valid date.
I need to implement this function in postgreSQL=20
can you help me?

------=_NextPart_000_001D_01C60F97.338F5E70
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable



charset=3Diso-8859-1">




I'm sorry. I'm from Argentina and my =
english is=20
very poor.

 

I am converting an aplication from =
Ms-SQL to=20
postgreSQL with ODBC.

I have a query  that use the=20
IsDate(string)  function (Ms function). This =
function=20
return true if the argument (string) is a valid date.

I need to implement this function in =
postgreSQL=20

can you help me?

 


------=_NextPart_000_001D_01C60F97.338F5E70--

Re: Function Like IsDate in pgSQL

am 02.01.2006 19:05:15 von Tom Lane

"Sistemas C.M.P." writes:
> I have a query that use the IsDate(string) function (Ms function). =
> This function return true if the argument (string) is a valid date.
> I need to implement this function in postgreSQL=20

In PG 8.0 and up this is trivial --- try to cast the string to date and
see if you get an error or not. Use the BEGIN ... EXCEPTION syntax
to catch the error and return false.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
choose an index scan if your joining column's datatypes do not
match