From: | "Dan Langille" <dan(at)langille(dot)org> |
---|---|
To: | Joseph Maxwell <jemaxwell(at)jaymax(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Field Constraints |
Date: | 2002-03-13 14:15:58 |
Message-ID: | 20020313141600.B139D3F0E@bast.unixathome.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On 6 Mar 2002 at 11:47, Joseph Maxwell wrote:
> Hello,
> I have created a DB and TABLE but would like to constrain one field to
> accept either "YES" or "NO" only. How can I set this up? I have tried
> various syntactic constructs of
>
[snip]
> -- Joe --
> PS-------------------------------------------------------------------------
> --------------
>
> Just learned that the datatype should be 'bool' in this case
>
> haven't tested it yet
>
> But had I wanted to restrict it to say either mike or john, or even one of
> a list say, 'tea', 'cofee', 'chocolate' or 'espresso', how should that be
> constructed?
Try:
found_in_ports boolean not null
default 'N'
check (
found_in_ports in ('Y','N'))
The same way as the above AFAIK>
--
Dan Langille
The FreeBSD Diary - http://freebsddiary.org/ - practical examples
From | Date | Subject | |
---|---|---|---|
Next Message | Darren Ferguson | 2002-03-13 14:40:13 | Re: Modifying text data? |
Previous Message | Marcelo Pereira | 2002-03-13 14:14:31 | Last Insert |