Received: from makus.postgresql.org (makus.postgresql.org [98.129.198.125]) by mail.postgresql.org (Postfix) with ESMTP id C76D41E62E82 for ; Wed, 25 Apr 2012 11:32:51 -0300 (ADT) Received: from andy.depesz.com ([88.198.47.100] helo=depesz.com) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1SN3Gz-0007bM-ST for pgsql-bugs@postgresql.org; Wed, 25 Apr 2012 14:32:50 +0000 Received: from andy.depesz.com ([88.198.47.100] helo=depesz.com) by depesz.com with esmtpa (Exim 4.77) (envelope-from ) id 1SN3Gk-0001WX-Pc; Wed, 25 Apr 2012 16:32:34 +0200 Date: Wed, 25 Apr 2012 16:32:33 +0200 From: hubert depesz lubaczewski To: atrigent@ccs.neu.edu Cc: pgsql-bugs@postgresql.org Subject: Re: BUG #6612: Functions can be called inside CHECK statements Message-ID: <20120425143233.GA4758@depesz.com> Reply-To: depesz@depesz.com References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-Pg-Spam-Score: -1.9 (-) X-Archive-Number: 201204/139 X-Sequence-Number: 32890 On Wed, Apr 25, 2012 at 10:33:10AM +0000, atrigent@ccs.neu.edu wrote: > Seeing as Postgres does not allow sub-queries in CHECK constraints yet, it > doesn't make any sense to me for it to allow function calls, since functions > can perform queries. Additionally, if a function is called from a check > constraint and that function executes a query, the change that caused the > check constraint to fire does not appear to be "visible" to the query. > Therefore, calling functions in check constraints does not have the ability > to check whether that change is valid, making it mostly useless. I fail to see how's that a bug. Using functions in check has uses, and the fact that you don't suit your particular case (or you don't know how to make them suit your case) is not a bug in Pg. Best regards, depesz -- The best thing about modern society is how easy it is to avoid contact with it. http://depesz.com/