From: | Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com> |
---|---|
To: | Rasmus Resen Amossen <spunk(at)rhk(dot)dk> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: subselects in check clauses |
Date: | 2001-06-04 22:00:19 |
Message-ID: | Pine.BSF.4.21.0106041444030.6154-100000@megazone23.bigpanda.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Mon, 4 Jun 2001, Rasmus Resen Amossen wrote:
> I have a need to check if a certain condition holds for all rows that
> matches a given criteria. But postgresql appearently doesn't support
> subselects in check clauses. Here is an example:
>
> CREATE TABLE example (a int, b date, c date
> CONSTRAINT csname CHECK (1 >= ALL (SELECT count(*)
> FROM example
> WHERE age(now(),b) > '0:0'
> AND age(now(),c) < '0:0'
> GROUP BY a)));
>
> CREATE
>
> INSERT INTO example VALUES (0,'2001-3-01','2001-12-12');
> ERROR: ExecEvalExpr: unknown expression type 108
>
> What can I do?
You can probably fake it by doing the check inside a trigger on
insert, update and delete.
From | Date | Subject | |
---|---|---|---|
Next Message | DaVinci | 2001-06-04 22:10:48 | Re: Updating views |
Previous Message | Peter Eisentraut | 2001-06-04 21:22:29 | FYI: status of native language support |