Re: Making planner skip hard-coded view values? - Mailing list pgsql-general

From Tom Lane
Subject Re: Making planner skip hard-coded view values?
Date
Msg-id 7898.1362713311@sss.pgh.pa.us
Whole thread Raw
In response to Making planner skip hard-coded view values?  (François Beausoleil <francois@teksol.info>)
List pgsql-general
=?iso-8859-1?Q?Fran=E7ois_Beausoleil?= <francois@teksol.info> writes:
> I have a view similar to this (regression at end):

> CREATE VIEW published_reports AS
>     SELECT true AS aired, *
>     FROM published_aired_reports
>   UNION ALL
>     SELECT false AS aired, *
>     FROM published_unaired_reports;

> Given that view definition, I expected a WHERE clause with the hard-coded value to ignore one of the tables:

> SELECT COUNT(*) FROM published_reports WHERE aired;

> This is on 9.1.3, but may have changed later.

Works for me.  After a quick glance at the release notes, I think this was
fixed in 9.1.4:

    * Fix planning of UNION ALL subqueries with output columns that are not simple variables (Tom Lane)

    Planning of such cases got noticeably worse in 9.1 as a result of a misguided fix for "MergeAppend child's
targetlistdoesn't match MergeAppend" errors. Revert that fix and do it another way. 

            regards, tom lane


pgsql-general by date:

Previous
From: Scott Marlowe
Date:
Subject: Re: Replication stopped on 9.0.2 after making change to conf file
Next
From: Guy Rouillier
Date:
Subject: Re: selecting for type cast failures