Re: Modifying check constraints

Поиск
Список
Период
Сортировка
От Thalis A. Kalfigopoulos
Тема Re: Modifying check constraints
Дата
Msg-id Pine.LNX.4.21.0111141343150.20050-100000@aluminum.cs.pitt.edu
обсуждение исходный текст
Ответ на Modifying check constraints  (Paulo Jan <admin@digital.ddnet.es>)
Список pgsql-general
On Wed, 14 Nov 2001, Paulo Jan wrote:

> Hi all:
>
>         Let's suppose I create a table with a CHECK constraint, like:
>
>         CREATE TABLE blabla (id int, tipo varchar(8),
>         CHECK tipo IN ('tipo1', 'tipo2', 'tipo3'))
>
>         Can I change the CHECK constraint afterwards? For example, can I
> add another value that "tipo" can have, or I'd have to recreate the
> table?

Add another constraint with
ALTER TABLE lala ADD CONSTRAINT lalaCheck2 CHECK tipo in ('t1','t2','t3','t4');

The new check will be in effect along with the old one. Make sure the check constraints don't allow disjoint sets of
valuescause then you won't be able to add anything to the table. 

cheers,
thalis


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

Предыдущее
От: "Bryan White"
Дата:
Сообщение: Re: multiple hard disk
Следующее
От: Jason Earl
Дата:
Сообщение: Re: Modifying check constraints