Re: Expression errors with "FOR UPDATE" and postgres_fdw withpartition wise join enabled. - Mailing list pgsql-hackers

From Robert Haas
Subject Re: Expression errors with "FOR UPDATE" and postgres_fdw withpartition wise join enabled.
Date
Msg-id CA+TgmobR9XWEhmF3s_WsoLNnnjaFyS_xtbrVG3dCGiUgof20Nw@mail.gmail.com
Whole thread Raw
In response to Re: Expression errors with "FOR UPDATE" and postgres_fdw with partitionwise join enabled.  (Etsuro Fujita <fujita.etsuro@lab.ntt.co.jp>)
Responses Re: Expression errors with "FOR UPDATE" and postgres_fdw withpartition wise join enabled.  (Robert Haas <robertmhaas@gmail.com>)
Re: Expression errors with "FOR UPDATE" and postgres_fdw withpartition wise join enabled.  (Andres Freund <andres@anarazel.de>)
List pgsql-hackers
On Wed, Jul 18, 2018 at 8:00 AM, Etsuro Fujita
<fujita.etsuro@lab.ntt.co.jp> wrote:
> [ new patch ]

+ /*
+ * If the child plan is an Append or MergeAppend, the targetlists of its
+ * subplans would have already been adjusted before we get here, so need
+ * to work here.
+ */
+ if (IsA(subplan, Append) || IsA(subplan, MergeAppend))
+ return;
+
+ /* The child plan should be a scan or join */
+ Assert(is_projection_capable_plan(subplan));

This looks like a terrible design to me.  If somebody in future
invents a new plan type that is not projection-capable, then this
could fail an assertion here and there won't be any simple fix.  And
if you reach here and the child targetlists somehow haven't been
adjusted, then you won't even fail an assertion, you'll just crash (or
maybe return wrong answers).

I'm going to study this some more now, but I really think this is
going in the wrong direction.

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


pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: Faster str to int conversion (was Table with large number of intcolumns, very slow COPY FROM)
Next
From: Victor Wagner
Date:
Subject: Non-portable shell code in pg_upgrade tap tests