From: Stephan Szabo <sszabo@megazone.bigpanda.com>
To: Iain <iain@mst.co.jp>
Cc: Karel Zak <zakkr@zf.jcu.cz>
Cc: Christoph Haller <ch@rodos.fzk.de>
Cc: Alexander M. Pravking <fduch@antar.bryansk.ru>
Cc: pgsql-sql@postgresql.org
Subject: Re: Validity check in to_date?
Date: Tue, 2 Dec 2003 08:15:24 -0800 (PST)
Message-ID: <20031202081242.M87630@megazone.bigpanda.com> (raw)
In-Reply-To: <005201c3b8c1$52374a60$7201a8c0@mst1x5r347kymb>
References: <20031127141125.GC87728@dyatel.antar.bryansk.ru>
<200312020927.KAA17321@rodos>
<20031202095713.GB17884@zf.jcu.cz>
<005201c3b8c1$52374a60$7201a8c0@mst1x5r347kymb>
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).
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: sszabo@megazone.bigpanda.com, iain@mst.co.jp, zakkr@zf.jcu.cz, ch@rodos.fzk.de, fduch@antar.bryansk.ru
Subject: Re: Validity check in to_date?
In-Reply-To: <20031202081242.M87630@megazone.bigpanda.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
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