Re: Surprising behavior with pushing predicates down into a view - Mailing list pgsql-bugs

From Tom Lane
Subject Re: Surprising behavior with pushing predicates down into a view
Date
Msg-id 2734942.1774979656@sss.pgh.pa.us
Whole thread Raw
In response to Re: Surprising behavior with pushing predicates down into a view  (Justin Christensen <justin.christensen89@gmail.com>)
List pgsql-bugs
Justin Christensen <justin.christensen89@gmail.com> writes:
> Ah. I did happen to skim the postgres source and I did see that subplans
> were being rejected in qual_is_pushdown_safe before I sent this over, and I
> noticed a few comments that made it seem like that was a design choice at
> the time that could stand to be revisited later: "XXX that could stand to
> be reconsidered, now that we use Paths."

Actually the relevant comment is this one:

 * 1. rinfo's clause must not contain any SubPlans (mainly because it's
 * unclear that it will work correctly: SubLinks will already have been
 * transformed into SubPlans in the qual, but not in the subquery).

Somebody who was sufficiently determined could probably make that
happen, but it's very unclear how much code and messiness would be
required.  Another potential path is to make SubLink->SubPlan
transformations happen later, after this step --- but I think that
would metastasize into a lot of places, and possibly have some
downsides in plan quality.

Short answer is that we might well end up rejecting such a patch even
if it got written.  This limitation is decades old, and there have not
been that many complaints, so I doubt we'd accept any large increase
in complexity to remove it.

            regards, tom lane



pgsql-bugs by date:

Previous
From: Justin Christensen
Date:
Subject: Re: Surprising behavior with pushing predicates down into a view
Next
From: Andrey Borodin
Date:
Subject: Re: BUG #19382: Server crash at __nss_database_lookup