Обсуждение: constraint expression

Поиск
Список
Период
Сортировка

constraint expression

От
2004@niederland.com (Roger Niederland)
Дата:
Hello,

I am having problems adding a simple expression to a table level
constraint.
Here is an example of one which postgresql 7.4.3 does not accept.

create table test (a int, b int, c int,
constraint aname check (((a=0) and (b is not null)) or ((a=1) and (c
is not null)));

Should this work?  It is complaining 'ERROR:  syntax error at or near
";" at character 126'

Thanks

Re: constraint expression

От
Kris Jurka
Дата:

On Fri, 6 Aug 2004, Roger Niederland wrote:

> create table test (a int, b int, c int,
> constraint aname check (((a=0) and (b is not null)) or ((a=1) and (c
> is not null)));
>

You are missing the closing ) for the create table statement.

Kris Jurka