On Thu, Jun 16, 2011 at 6:04 AM, Mike Christensen <mike(at)kitchenpc(dot)com> wrote:
> 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.
--
Simon Riggs http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services