Received: from magus.postgresql.org ([87.238.57.229]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TNpQF-0007m3-MD for pgsql-bugs@postgresql.org; Mon, 15 Oct 2012 18:29:51 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TNpQA-000700-B7 for pgsql-bugs@postgresql.org; Mon, 15 Oct 2012 18:29:51 +0000 Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.5/8.14.5) with ESMTP id q9FIThnS029763; Mon, 15 Oct 2012 14:29:43 -0400 (EDT) From: Tom Lane To: Bill MacArthur cc: pgsql-bugs@postgresql.org Subject: Re: BUG #7604: adding criteria to a query against a view in 9.2 expands the results instead of constraining them In-reply-to: <507C53F3.70606@dhs-club.com> References: <13773.1350317896@sss.pgh.pa.us> <507C53F3.70606@dhs-club.com> Comments: In-reply-to Bill MacArthur message dated "Mon, 15 Oct 2012 14:20:35 -0400" Date: Mon, 15 Oct 2012 14:29:43 -0400 Message-ID: <29762.1350325783@sss.pgh.pa.us> X-Pg-Spam-Score: -2.3 (--) X-Archive-Number: 201210/152 X-Sequence-Number: 34452 Bill MacArthur writes: > Tom, in preparation for a test case I created a new schema (testcase) and copied 6 tables to that, including only the columns significant to enable the VIEWs to be created. I took the 3 VIEWs involved and tweaked them into the new schema (just renamed to testcase.viewname and referencing testcase.relation). However, when run from in there, the results are as expected rather than erroneous. The live data and VIEWs still produce erroneous results. Any clues?? Is the query plan the same according to EXPLAIN? If not, you may have forgotten to vacuum/analyze the new tables, or forgotten some relevant index. Or it might be that the total table size is affecting the plan choice, in which case you need dummy data in the "irrelevant" columns rather than removing them altogether. regards, tom lane