Re: check constraint

From: oberpwd(at)anubis(dot)network(dot)com (Wade D(dot) Oberpriller)
To: martin(at)math(dot)unl(dot)edu(dot)ar (Martin A(dot) Marques)
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: check constraint
Date: 2000-12-18 15:43:26
Message-ID: 200012181543.JAA08690@truck.network.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

You should be able to do the following:

CREATE TABLE table1 (
field1 INTEGER CHECK ((field1 >= 0) AND (field1 <= 10))
);

Wade Oberpriller

>
> Hi,
> how should I write a constraint that can keep an INT field with values
> between 0 and 10? Do I have to use two checks on the same field?
>
> TIA
>
> --
> System Administration: It's a dirty job,
> but someone told I had to do it.
> -----------------------------------------------------------------
> Martín Marqués email: martin(at)math(dot)unl(dot)edu(dot)ar
> Santa Fe - Argentina http://math.unl.edu.ar/~martin/
> Administrador de sistemas en math.unl.edu.ar
> -----------------------------------------------------------------
>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Martin A. Marques 2000-12-18 15:46:06 Re: check constraint
Previous Message Martin A. Marques 2000-12-18 15:30:06 check constraint