Received: from makus.postgresql.org ([98.129.198.125]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TNpvD-0003ph-Q8 for pgsql-bugs@postgresql.org; Mon, 15 Oct 2012 19:01:51 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TNpv9-0004gi-48 for pgsql-bugs@postgresql.org; Mon, 15 Oct 2012 19:01: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 q9FJ1iDe002891; Mon, 15 Oct 2012 15:01:44 -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: <507C5A71.50807@dhs-club.com> References: <13773.1350317896@sss.pgh.pa.us> <507C53F3.70606@dhs-club.com> <29762.1350325783@sss.pgh.pa.us> <507C5A71.50807@dhs-club.com> Comments: In-reply-to Bill MacArthur message dated "Mon, 15 Oct 2012 14:48:17 -0400" Date: Mon, 15 Oct 2012 15:01:44 -0400 Message-ID: <2890.1350327704@sss.pgh.pa.us> X-Pg-Spam-Score: -2.3 (--) X-Archive-Number: 201210/154 X-Sequence-Number: 34454 Bill MacArthur writes: > Update, I started placing primary keys on the testcase tables and watched the planner output. Once I put a PK on one of the tables in particular, the planner revised the plan to use the PK. At that point, the results become erroneous as the planner also moves another filter evaluation to an earlier point at which time I don't think it has the data to make the decision. Curious ... > I can still finish up with the test case if you like, but here is a highlight. The first VIEW, which I did not originally post is this: Test case, please. regards, tom lane