Received: from makus.postgresql.org (makus.postgresql.org [98.129.198.125]) by mail.postgresql.org (Postfix) with ESMTP id A9B09308F35 for ; Thu, 26 Apr 2012 00:59:39 -0300 (ADT) Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1SNFrm-0004Dy-Pl for pgsql-bugs@postgresql.org; Thu, 26 Apr 2012 03:59:39 +0000 Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id q3Q3xO0N022339; Wed, 25 Apr 2012 23:59:24 -0400 (EDT) To: Ari Entlich cc: pgsql-bugs@postgresql.org Subject: Re: BUG #6612: Functions can be called inside CHECK statements In-reply-to: <3125270.869581335385510960.JavaMail.root@zimbra> References: <3125270.869581335385510960.JavaMail.root@zimbra> Comments: In-reply-to Ari Entlich message dated "Wed, 25 Apr 2012 16:25:11 -0400" Date: Wed, 25 Apr 2012 23:59:24 -0400 Message-ID: <22338.1335412764@sss.pgh.pa.us> From: Tom Lane X-Pg-Spam-Score: -1.9 (-) X-Archive-Number: 201204/151 X-Sequence-Number: 32902 Ari Entlich writes: > 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. That statement seems to me to be complete nonsense. You can certainly put a query into a function invoked by CHECK. It may be that there's some particular use-case that this doesn't work for, but that does not justify a blanket statement that it "doesn't work". regards, tom lane