Test text value as interval

From: Robert Fitzpatrick <lists(at)webtent(dot)net>
To: PostgreSQL <pgsql-general(at)postgresql(dot)org>
Subject: Test text value as interval
Date: 2008-02-08 00:37:45
Message-ID: 1202431065.8707.38.camel@columbus.webtent.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Been searching for a way to do this, but haven't found what I was hoping
to find. Is there any way in pl/pgsql to test a text value to see if it
would be a valid interval without having to try and store in a field? In
a trigger, I'd like to test a NEW text type field. Right now, I have
just the following to generate an error...

test := NEW.textfield::interval;

I'd like to test the field and RAISE EXCEPTION if not valid interval.

--
Robert

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Jeff Davis 2008-02-08 00:58:36 Re: Test text value as interval
Previous Message SunWuKung 2008-02-08 00:20:20 Re: "advanced" database design (long)