Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1Tr8Wh-0007TO-9E for pgsql-bugs@arkaria.postgresql.org; Fri, 04 Jan 2013 14:45:39 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.72) (envelope-from ) id 1Tr8Wg-0003HY-PW for pgsql-bugs@arkaria.postgresql.org; Fri, 04 Jan 2013 14:45:38 +0000 Received: from makus.postgresql.org ([98.129.198.125]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1Tr8G1-00050F-Gc for pgsql-bugs@postgresql.org; Fri, 04 Jan 2013 14:28:25 +0000 Received: from mahout.postgresql.org ([98.129.198.123]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1Tr8G0-0003cI-9p for pgsql-bugs@postgresql.org; Fri, 04 Jan 2013 14:28:24 +0000 Received: from [204.145.124.246] (helo=wrigleys.postgresql.org) by mahout.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1Tr8Fz-0000rR-Tz for pgsql-bugs@postgresql.org; Fri, 04 Jan 2013 14:28:24 +0000 Received: from www-data by wrigleys.postgresql.org with local (Exim 4.72) (envelope-from ) id 1Tr8Fz-00087d-MI for pgsql-bugs@postgresql.org; Fri, 04 Jan 2013 14:28:23 +0000 Date: Fri, 04 Jan 2013 14:28:23 +0000 Message-Id: Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Subject: BUG #7786: select from view is computing columns not selected To: pgsql-bugs@postgresql.org From: doug@oakstreetsoftware.com X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org The following bug has been logged on the website: Bug reference: 7786 Logged by: Douglas Toltzman Email address: doug@oakstreetsoftware.com PostgreSQL version: 9.2.2 Operating system: Linux CentOS Description:=20=20=20=20=20=20=20=20 in the interest of simplicity, I've got a view that calls a stored procedure to compute a value ... create view testv as select tt.field1, tt.intfield, compute_val(tt.field1) AS compute1 from tt; If compute_val() selects sum(intfield) from the testv view, compute_val() is called again when selecting records from testv (even though compute1 was not selected), resulting in infinite recursion (stack overflow). In retrospect, I realize this may have been a bad thing to do, but it worked in version 8.1.x. I recently upgraded to 9.2.2 and I had to create a 2nd view that didn't include the computed values, so I could use that view in the stored procedures. It seems like a performance problem to compute all columns in a view when selecting only specific columns. I've already fixed my stack overflow, so I'll let you decide if this is a bug or a feature. If you're interested in reproducing this and you don't understand my description, I'd be happy to provide a test case. --=20 Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs