Re: Validity check in to_date?

From: "Alexander M(dot) Pravking" <fduch(at)antar(dot)bryansk(dot)ru>
To: Iain <iain(at)mst(dot)co(dot)jp>
Cc: Karel Zak <zakkr(at)zf(dot)jcu(dot)cz>, Christoph Haller <ch(at)rodos(dot)fzk(dot)de>, pgsql-sql(at)postgresql(dot)org
Subject: Re: Validity check in to_date?
Date: 2003-12-02 10:55:06
Message-ID: 20031202105506.GI87728@dyatel.antar.bryansk.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Tue, Dec 02, 2003 at 07:44:54PM +0900, Iain wrote:
> T've been following this thread with interest because I have a related
> problem. Basically we are storing dates in CHAR fields with al the
> associated problems. I'd like to do it, but changing everything to date
> fields isn't practical for now, so as a stopgap solution, I want to provide
> some validation at the database level.
>
> I tried:
>
> create domain ymdtest2 as char(10) constraint valid_date check
> (VALUE::DATE);

There's no conversion function from char(n) to date, but there's one
from text to date. Try using check (VALUE::text::date).

--
Fduch M. Pravking

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Alexander M. Pravking 2003-12-02 10:58:35 Re: Validity check in to_date?
Previous Message Iain 2003-12-02 10:44:54 Re: Validity check in to_date?