subselects in check clauses

From: Rasmus Resen Amossen <spunk(at)rhk(dot)dk>
To: pgsql-general(at)postgresql(dot)org
Subject: subselects in check clauses
Date: 2001-06-04 20:48:47
Message-ID: 3B1BF42F.CE6E24EB@rhk.dk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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?
--
Rasmus Resen Amossen | stud.mat.dat at the University of Copenhagen
Jagtvej 120, -244 | http://www.math.ku.dk/muh
2200 Kbh. N | http://w1.1444.telia.com/~u144400001

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Rasmus Resen Amossen 2001-06-04 21:12:56 Updating views
Previous Message HYip 2001-06-04 20:46:09 getting non-atomic field with C API