Constraint allowing value up to 2 times but no more than 2 times

From: Dara Unglaube <dara(at)glifwc(dot)org>
To: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Constraint allowing value up to 2 times but no more than 2 times
Date: 2015-10-12 17:04:13
Message-ID: CA+ca-rquDV-=ytRoBi6KM-v=w-78YS7piT+jOeCkyZRiHa-R6g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Greeetings.
I'm trying to come up with a way to allow one column to have the same value
up to two times, but no more than two times. I attempted adding a
constraint to check the count of the value in the field - count (trsqqq)
<=2 but aggregate functions are not allowed in constraints. Is there
another way to do this? Any help would be greatly appreciated.
Thanks in advance.
Dara

*--Dara J. Olson Unglaube*
Aquatic Invasive Species Coordinator, Spatial Database Manager
Great Lakes Indian Fish & Wildlife Commission
P.O. Box 9, 72682 Maple Street
Odanah, WI 54861
(715) 682-6619 ext.2129
dara(at)glifwc(dot)org <dolson(at)glifwc(dot)org>
maps.glifwc.org

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Jim Nasby 2015-10-12 17:08:22 Re: Constraint allowing value up to 2 times but no more than 2 times
Previous Message Steve Pribyl 2015-10-12 16:54:19 Re: BDR workers exiting?