Thread: add constraint deferrable, syntax error

add constraint deferrable, syntax error

From
"Gauthier, Dave"
Date:

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...

 

v8.3.4 on linux

 

Re: add constraint deferrable, syntax error

From
Andreas Kretschmer
Date:
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°