pg.ddx.io  pgsql-odbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Function Like IsDate in pgSQL
2+ messages / 2 participants
[nested] [flat]

* Function Like IsDate in pgSQL
@ 2006-01-02 15:22  Sistemas C.M.P. <sistemascmp@redynet4.com.ar>
  0 siblings, 1 reply; 2+ messages in thread

From: Sistemas C.M.P. @ 2006-01-02 15:22 UTC (permalink / raw)
  To: pgsql-odbc

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 
can you help me?

^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: Function Like IsDate in pgSQL
@ 2006-01-02 18:05  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Sistemas C.M.P. <sistemascmp@redynet4.com.ar>
  0 siblings, 0 replies; 2+ messages in thread

From: Tom Lane @ 2006-01-02 18:05 UTC (permalink / raw)
  To: Sistemas C.M.P. <sistemascmp@redynet4.com.ar>; +Cc: pgsql-odbc

"Sistemas C.M.P." <sistemascmp@redynet4.com.ar> 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



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2006-01-02 18:05 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2006-01-02 15:22 Function Like IsDate in pgSQL Sistemas C.M.P. <sistemascmp@redynet4.com.ar>
2006-01-02 18:05 ` Tom Lane <tgl@sss.pgh.pa.us>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox