Is exec_simple_check_node still doing anything?

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Is exec_simple_check_node still doing anything?
Date: 2017-06-20 20:51:36
Message-ID: CA+TgmoZGZpwdEV2FQWaVxA_qZXsQE1DAS5Fu8fwxXDNvfndiUQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I'm a little mystified by exec_simple_check_node(). The regression
tests seem not to exercise it. It can only be reached when
exec_simple_recheck_plan() finds no other reason to reject the plan,
and the only case it seems to reject is the one where there's a
set-returning function buried in there someplace. But then it seems
like hasTargetSRFs would have been true and we would have given up
before making a plan in the first place. Of course, that only
protects us when originally forming the plan; they don't account for
later changes -- and the code comments claim that an expression which
was originally simple can become non-simple:

* It is possible though unlikely for a simple expression to become non-simple
* (consider for example redefining a trivial view).

But I can't quite figure that one out. If we're selecting from a
trivial view, then the range table won't be empty and the expression
won't be simple in the first place. The check for a non-empty range
table didn't exist when this comment was originally added
(95f6d2d20921b7c2dbec29bf2706fd9448208aa6, 2007); it was added in a
subsequent redesign (e6faf910d75027bdce7cd0f2033db4e912592bcc; 2011).
Did that, possibly, remove the last way in which a simple expression
could be could become non-simple? If so, between that and the new
hasTargetSRFs test, it might now be impossible for
exec_simple_check_node() to fail.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David G. Johnston 2017-06-20 20:58:01 Re: Typo in insert.sgml
Previous Message Tom Lane 2017-06-20 20:36:43 Re: Something is rotten in publication drop