Re: add constraint deferrable, syntax error - Mailing list pgsql-general

From Andreas Kretschmer
Subject Re: add constraint deferrable, syntax error
Date
Msg-id 20120111180921.GA16936@tux
Whole thread Raw
In response to add constraint deferrable, syntax error  ("Gauthier, Dave" <dave.gauthier@intel.com>)
List pgsql-general
Gauthier, Dave <dave.gauthier@intel.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°

pgsql-general by date:

Previous
From: Scott Marlowe
Date:
Subject: Re: Enumeration of tables is very slow in largish database
Next
From: Scott Marlowe
Date:
Subject: Re: indexes no longer used after shutdown during reindexing