Based on your first question a customer id itself is not a valid designator;
you have to specify (or link) in the group as well.
Not tested but should work:
FOREIGN KEY (template, group) REFERENCES customer (cust_id, group)
Depends on whether you want to allow cross-group associations if you need a
separate group template id.
David J.
--
View this message in context: http://postgresql.1045698.n5.nabble.com/check-constraint-question-tp5799252p5799282.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.