Received: from localhost (maia-5.hub.org [200.46.204.182]) by postgresql.org (Postfix) with ESMTP id A1B369FA1A1 for ; Wed, 29 Nov 2006 13:26:48 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.182]) (amavisd-new, port 10024) with ESMTP id 58027-04 for ; Wed, 29 Nov 2006 13:26:42 -0400 (AST) X-Greylist: delayed 00:18:12.477278 by SQLgrey-1.7.4 Received: from mail.socialserve.com (office.socialserve.com [208.60.89.34]) by postgresql.org (Postfix) with ESMTP id D0DF69FA103 for ; Wed, 29 Nov 2006 13:26:42 -0400 (AST) Received: from localhost (localhost.localdomain [127.0.0.1]) by mail.socialserve.com (Postfix) with ESMTP id BFBAF396D2C for ; Wed, 29 Nov 2006 12:08:27 -0500 (EST) X-Virus-Scanned: by amavisd-new at socialserve.com Received: from mail.socialserve.com ([127.0.0.1]) by localhost (ms3.socialserve.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id PbddQkRBXuIk for ; Wed, 29 Nov 2006 12:08:22 -0500 (EST) Received: from [10.1.1.43] (jlrobins.socialserve.com [10.1.1.43]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by mail.socialserve.com (Postfix) with ESMTP id 87CE2396D2A for ; Wed, 29 Nov 2006 12:08:12 -0500 (EST) Mime-Version: 1.0 (Apple Message framework v752.2) Content-Transfer-Encoding: 7bit Message-Id: <6881FC4D-8F7C-477B-9AAA-C9B5282D88B2@socialserve.com> Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed To: pgsql-sql@postgresql.org From: James Robinson Subject: Subselects in CHECK clause ... Date: Wed, 29 Nov 2006 12:08:12 -0500 X-Mailer: Apple Mail (2.752.2) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200611/275 X-Sequence-Number: 26927 I see that subselects are not directly supported in check clauses, but one can work around that by writing a stored function which returns boolean and performs the subselect. Are there any known gotchas with doing this? The CREATE TABLE docs regarding CHECK clauses states: "Currently, CHECK expressions cannot contain subqueries nor refer to variables other than columns of the current row." Is this due to someone not yet writing the necessary code to remove the subquery clause, or is there a more fundamental reason? ---- James Robinson Socialserve.com