Re: Syntax of: alter table ... add constraint ...

From: Alban Hertroys <dalroi(at)solfertje(dot)student(dot)utwente(dot)nl>
To: Alexander Farber <alexander(dot)farber(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Syntax of: alter table ... add constraint ...
Date: 2010-11-08 16:50:58
Message-ID: 914F325A-FC52-4C5F-8E2A-0C4816ABDD56@solfertje.student.utwente.nl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 8 Nov 2010, at 16:18, Alexander Farber wrote:

> Thank you,
>
> alter table pref_users add constraint pref_users_medals_check check
> (medals >= 0);
>
> has worked!

To clarify a bit on this; if you add a constraint, you specify its name and what type of constraint it is, before specifying the actual constraint expression.
Hence the need to add 'check' (the constraint type) between 'pref_users_medals_check' (the name) and '(medals >= 0)' (the expression).

Alban Hertroys

--
If you can't see the forest for the trees,
cut the trees and you'll see there is no forest.

!DSPAM:737,4cd82a7b10261263518415!

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message John R Pierce 2010-11-08 16:51:06 Re: postgresql scalability issue
Previous Message Scott Marlowe 2010-11-08 16:29:34 Re: postgresql scalability issue