Received: from makus.postgresql.org (makus.postgresql.org [98.129.198.125]) by mail.postgresql.org (Postfix) with ESMTP id A42B81E62E85 for ; Wed, 25 Apr 2012 17:25:32 -0300 (ADT) Received: from amber.ccs.neu.edu ([129.10.116.51]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1SN8mJ-0005QF-DC for pgsql-bugs@postgresql.org; Wed, 25 Apr 2012 20:25:31 +0000 Received: from zimbra.ccs.neu.edu ([129.10.116.59]) by amber.ccs.neu.edu with esmtp (Exim 4.69) (envelope-from ) id 1SN8m5-0003gX-Vl for pgsql-bugs@postgresql.org; Wed, 25 Apr 2012 16:25:18 -0400 Received: from localhost (localhost [127.0.0.1]) by zimbra.ccs.neu.edu (Postfix) with ESMTP id E2B2CF5C00B for ; Wed, 25 Apr 2012 16:25:17 -0400 (EDT) X-Virus-Scanned: amavisd-new at zimbra.ccs.neu.edu Received: from zimbra.ccs.neu.edu ([127.0.0.1]) by localhost (zimbra.ccs.neu.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id m8PJnCvqZfJa for ; Wed, 25 Apr 2012 16:25:11 -0400 (EDT) Received: from zimbra.ccs.neu.edu (zimbra.ccs.neu.edu [129.10.116.59]) by zimbra.ccs.neu.edu (Postfix) with ESMTP id B4B2BF5C007 for ; Wed, 25 Apr 2012 16:25:11 -0400 (EDT) Date: Wed, 25 Apr 2012 16:25:11 -0400 (EDT) From: Ari Entlich To: pgsql-bugs@postgresql.org Message-ID: <3125270.869581335385510960.JavaMail.root@zimbra> In-Reply-To: <33469192.869561335385504681.JavaMail.root@zimbra> Subject: Re: BUG #6612: Functions can be called inside CHECK statements MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Originating-IP: [155.33.137.78] X-Mailer: Zimbra 5.0.22_GA_3210.UBUNTU6 (ZimbraWebClient - FF3.0 (Win)/5.0.22_GA_3210.UBUNTU6) X-Pg-Spam-Score: -4.2 (----) X-Archive-Number: 201204/149 X-Sequence-Number: 32900 Wow, so I guess I'm pretty much wrong about this... Sorry for the noise guys. I failed to consider different uses for functions, obviously, and it's not possible to automatically detect usages which could cause problems. Perhaps this is more of a bug in the documentation than anything else. I couldn't find any documentation for the behavior for what will happen if a query is executed inside a function which is called from a check statement. I also couldn't find anything about calling function inside check statements in general, but perhaps that's not necessary. I do, however, think it should definitely be documented somewhere that functions cannot be used to get around the lack of check statement subqueries, because the ordering of operations is wrong. Thanks! Ari