Re: Validity check in to_date?

Поиск
Список
Период
Сортировка
От Stephan Szabo
Тема Re: Validity check in to_date?
Дата
Msg-id 20031202081242.M87630@megazone.bigpanda.com
обсуждение исходный текст
Ответ на Re: Validity check in to_date?  ("Iain" <iain@mst.co.jp>)
Список pgsql-sql
On Tue, 2 Dec 2003, 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);
>
> But it gives this error:
>
> ERROR:  cannot cast type character to date
>
> I also tried:
>
> create domain test char(10) check (CAST(VALUE AS DATE));

I'd try CAST(CAST(VALUE AS TEXT) AS DATE)

There's a text->date conversion, but not one from character(n).



В списке pgsql-sql по дате отправления:

Предыдущее
От: Christoph Haller
Дата:
Сообщение: Re: Ooops ! :( Recovery techniques
Следующее
От: Bob Smith
Дата:
Сообщение: Re: Problem with intervals