Search Postgresql Archives

Re: Constraint to ensure value does NOT exist in another table?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>> I know I can setup a FK constraint to make sure Table1.ColA exists in
>> Table2.Key, however what if I want to do the reverse?
>>
>> I want to ensure Table1.ColA does NOT exist in Table2.Key..  Can I do
>> this with any sort of CHECK constraint, trigger, custom function, etc?
>
>
> The most common constraints are provided for, but then after that you
> have to use triggers.
>
> PostgreSQL deliberately doesn't support queries in CHECK constraints
> for this reason.

Thanks!  I wrote a Trigger for this and it seems to work fairly well..
 I kinda figured that was the obvious way, but thought there might be
some new 9.x feature that made this sort of thing possible.

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux