Re: add constraint deferrable, syntax error

From: Andreas Kretschmer <akretschmer(at)spamfence(dot)net>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: add constraint deferrable, syntax error
Date: 2012-01-11 18:09:21
Message-ID: 20120111180921.GA16936@tux
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Gauthier, Dave <dave(dot)gauthier(at)intel(dot)com> wrote:

> Why am I getting this?
>
>
>
> xdb=# alter table templates add constraint manager_uid_is_invalid check
> ((constraint_checker('manager',manager,null,null)) = 'OK') DEFERRABLE ;
>
> ERROR: syntax error at or near "DEFERRABLE"
>
> LINE 1: ...int_checker('manager',manager,null,null)) = 'OK') DEFERRABLE...

1st, i think, you should it rewrite to:

((constraint_checker('manager',manager,null,null) = 'OK'))

2nd, check-constraints ARE NOT DEFERRABLE !!!

http://www.postgresql.org/docs/current/static/sql-createtable.html says:
Currently, only UNIQUE, PRIMARY KEY, EXCLUDE, and REFERENCES (foreign
key) constraints accept this clause. NOT NULL and CHECK constraints are
not deferrable.

Andreas
--
Really, I'm not out to destroy Microsoft. That will just be a completely
unintentional side effect. (Linus Torvalds)
"If I was god, I would recompile penguin with --enable-fly." (unknown)
Kaufbach, Saxony, Germany, Europe. N 51.05082°, E 13.56889°

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Matt Dew 2012-01-11 18:22:44 Re: indexes no longer used after shutdown during reindexing
Previous Message Scott Marlowe 2012-01-11 18:07:55 Re: indexes no longer used after shutdown during reindexing