Received: from relay04.esat.net (relay04.esat.net [192.111.39.47]) by hub.org (8.10.1/8.10.1) with ESMTP id e58AsLb99348 for ; Thu, 8 Jun 2000 06:54:22 -0400 (EDT) Received: from (ebeon.com) [193.120.161.91] by relay04.esat.net with esmtp id 12zzx3-0005Tt-00; Thu, 08 Jun 2000 11:54:17 +0100 Message-ID: <393F8A00.1D2D4AB5@ebeon.com> Date: Thu, 08 Jun 2000 12:56:48 +0100 From: Niall Smart X-Mailer: Mozilla 4.7 [en] (X11; I; Linux 2.2.12 i386) X-Accept-Language: en MIME-Version: 1.0 To: Hiroshi Inoue CC: pgsql-sql@postgresql.org Subject: Re: Problem with subquery in CHECK constraint. References: <000901bfd0df$f57c1f20$2801007e@tpf.co.jp> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Archive-Number: 200006/87 CONSTRAINT TYPE_CD_OK CHECK ( EXISTS (SELECT 1 FROM XREF WHERE XREF_GROUP = 'CUST_TYPE' AND XREF_CD = TYPE_CD) ) > There seems to be more serious problems. > 1) The constraint is not only for the defined table but also for referenced > tables in the subquery. I don't understand what you mean -- the constraint only constrains 1 column in one table... > 2) There should be some standard lock mechanism for the range restricted > by the subquery. > > I'm suspicious that we should/could implement constraints other than > column constraints. Again, I don't fully understand what you're saying; but I have successfully implemented the constraint using a user defined function. Niall