Re: CHECK constraint
От | paul butler |
---|---|
Тема | Re: CHECK constraint |
Дата | |
Msg-id | 0f5683353140d33PCOW058M@blueyonder.co.uk обсуждение исходный текст |
Ответ на | CHECK constraint (Ben Clewett <B.Clewett@roadrunner.uk.com>) |
Ответы |
Re: CHECK constraint
|
Список | pgsql-novice |
Date sent: Thu, 13 Mar 2003 14:35:40 +0000 From: Ben Clewett <B.Clewett@roadrunner.uk.com> Copies to: pgsql-novice@postgresql.org Subject: [NOVICE] CHECK constraint Ben, Would foreign keys not be the simplest solution? CREATE TABLE foo( id int4 NOT NULL, FOREIGN KEY (id) REFERENCES bar(id) ON DELETE CASCADE ON UPDATE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE, ) In SQL standards, I belive a SELECT query is valid in a check constraint: CREATE TABLE foo ( a INT CHECK ( a IN ( SELECT b FROM bar WHERE .... ) ) } > However, this seems not to be the case (yet) in PostgreSQL. > > Should I do this with Triggers instead? Are there any other elegent > methods of doing the same? Ben ---------------------------(end of broadcast)--------------------------- TIP 2: you can get off all lists at once with the unregister command (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
В списке pgsql-novice по дате отправления: