Thread: non fatal casting?

non fatal casting?

From
hubert depesz lubaczewski
Date:
hi
is there any way to make non-fatal casts (text -=> date and so on?)
it would be just perfect if i could do something like:
try:
    my_date := my_text::date;
except:
    return -1;
end:
    return 0;

i'd like to use it in plpgsql functions. anyway to do it?

depesz

--
hubert depesz lubaczewski                          http://www.depesz.pl/
------------------------------------------------------------------------
... vows are spoken to be broken ...                 [enjoy the silence]
... words are meaningless and forgettable ...             [depeche mode]