Re: [sqlsmith] Failed assertion in postgres_fdw/deparse.c:1116 - Mailing list pgsql-hackers

From Ashutosh Bapat
Subject Re: [sqlsmith] Failed assertion in postgres_fdw/deparse.c:1116
Date
Msg-id CAFjFpRdg4hOXz+DftGnmRvHSM93Y_JRs4BVFeEA3nisLdk_4Cg@mail.gmail.com
Whole thread Raw
In response to Re: [sqlsmith] Failed assertion in postgres_fdw/deparse.c:1116  (Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>)
Responses Re: [sqlsmith] Failed assertion in postgres_fdw/deparse.c:1116
List pgsql-hackers


On Tue, Jun 7, 2016 at 4:07 PM, Amit Langote <Langote_Amit_f8@lab.ntt.co.jp> wrote:
On 2016/06/07 19:13, Ashutosh Bapat wrote:
> I thought, columns of inner relation will be set to null during projection
> from ForeignScan for joins. But I was wrong. If we want to push-down joins
> in this case, we have two solutions
> 1. Build queries with subqueries at the time of deparsing. Thus a base
> relation or join has to include placeholders while being deparsed as a
> subquery. This means that the deparser should deparse expression
> represented by the placeholder. This may not be possible always.
> 2. At the time of projection from ForeignScan recognize the nullable
> placeholders and nullify them if the corresponding relation is nullified.
> That looks like a major surgery.
> So, your patch looks to be the correct approach (even after we support
> deparsing subqueries). Can you please include a test in regression?

I added a slightly modified version of your test to the originally posted
patch.

Looks good to me. If we add a column from the outer relation, the "NULL"ness of inner column would be more clear. May be we should tweak the query to produce few more rows, some with non-NULL columns from both the relations. Also add a note to the comment in the test mentioning that such a join won't be pushed down for a reader to understand the EXPLAIN output. Also, you might want to move that test, closer to other un-pushability tests.


--
Best Wishes,
Ashutosh Bapat
EnterpriseDB Corporation
The Postgres Database Company

pgsql-hackers by date:

Previous
From: Pavel Stehule
Date:
Subject: Re: slower connect from hostnossl clients
Next
From: Robert Haas
Date:
Subject: Re: Problem with dumping bloom extension