Re: [GENERAL] CHECK for 2 FKs to be non equal - Mailing list pgsql-general

From Alban Hertroys
Subject Re: [GENERAL] CHECK for 2 FKs to be non equal
Date
Msg-id AF44485A-FCF5-4AE2-8010-B99A902583CA@gmail.com
Whole thread Raw
In response to [GENERAL] CHECK for 2 FKs to be non equal  (Alexander Farber <alexander.farber@gmail.com>)
Responses Re: [GENERAL] CHECK for 2 FKs to be non equal
List pgsql-general
> On 11 Mar 2017, at 10:41, Alexander Farber <alexander.farber@gmail.com> wrote:
>
>          uid integer NOT NULL REFERENCES words_users(uid) CHECK (uid <> author) ON DELETE CASCADE,

> but get syntax error in 9.5:
>
> ERROR:  syntax error at or near "ON"
> LINE 2: ...REFERENCES words_users(uid) CHECK (uid <> author) ON DELETE …

You put your CHECK constraint definition smack in the middle of the FK constraint definition, which starts with
REFERENCESand ends with the delete CASCADE. 

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



pgsql-general by date:

Previous
From: Francisco Olarte
Date:
Subject: Re: [GENERAL] CHECK for 2 FKs to be non equal
Next
From: Alexander Farber
Date:
Subject: Re: [GENERAL] CHECK for 2 FKs to be non equal