From: | Thomas Kellerer <spam_eater(at)gmx(dot)net> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Syntax of: alter table ... add constraint ... |
Date: | 2010-11-08 15:10:18 |
Message-ID: | ib93sp$5te$1@dough.gmane.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Alexander Farber, 08.11.2010 15:50:
> And then I realized that I actually want
>
> medals smallint default 0 check (medals>= 0)
>
> So I've dropped the old constraint with
>
> alter table pref_users drop constraint "pref_users_medals_check";
>
> but how can I add the new contraint please? I'm trying:
>
> alter table pref_users add constraint pref_users_medals_check (medals>= 0);
> ERROR: syntax error at or near "("
> LINE 1: ...pref_users add constraint pref_users_medals_check (medals>=...
> ^
> and many combinations of quotes and "check" inbetween,
> but can't find the correct syntax
That should work:
alter table pref_users add constraint pref_users_medals_check check check (medals >= 0);
Thomas
From | Date | Subject | |
---|---|---|---|
Next Message | Raymond O'Donnell | 2010-11-08 15:13:39 | Re: Syntax of: alter table ... add constraint ... |
Previous Message | Cédric Villemain | 2010-11-08 15:08:49 | Re: migrate from 8.1 to 9.0 |