Re: Asymmetric partition-wise JOIN - Mailing list pgsql-hackers

From Andrey V. Lepikhov
Subject Re: Asymmetric partition-wise JOIN
Date
Msg-id 2c9caede-55c0-2042-e421-dd0021f28837@postgrespro.ru
Whole thread Raw
In response to Re: Asymmetric partition-wise JOIN  (Jaime Casanova <jcasanov@systemguards.com.ec>)
Responses Re: Asymmetric partition-wise JOIN
List pgsql-hackers
On 9/9/21 8:38 PM, Jaime Casanova wrote:
> On Thu, Sep 09, 2021 at 09:50:46AM +0000, Aleksander Alekseev wrote:
>> It looks like this patch needs to be updated. According to http://cfbot.cputube.org/ it applies but doesn't pass any
tests.Changing the status to save time for reviewers.
 
>>
>> The new status of this patch is: Waiting on Author
> 
> Just to give some more info to work on I found this patch made postgres
> crash with a segmentation fault.
> 
> """
> Program terminated with signal SIGSEGV, Segmentation fault.
> #0  0x0000556e37ef1b55 in bms_equal (a=0x7f6e37a9c5b0, b=0x7f6e37a9c5b0) at bitmapset.c:126
> 126            if (shorter->words[i] != longer->words[i])
> """
> 
> attached are the query that triggers the crash and the backtrace.
> 

Thank you for this good catch!
The problem was in the adjust_child_relids_multilevel routine. The 
tmp_result variable sometimes points to original required_outer.
This patch adds new ways which optimizer can generate plans. One 
possible way is optimizer reparameterizes an inner by a plain relation 
from the outer (maybe as a result of join of the plain relation and 
partitioned relation). In this case we have to compare tmp_result with 
original pointer to realize, it was changed or not.
The patch in attachment fixes this problem. Additional regression test 
added.

-- 
regards,
Andrey Lepikhov
Postgres Professional

Attachment

pgsql-hackers by date:

Previous
From: Michael Paquier
Date:
Subject: Re: Add jsonlog log_destination for JSON server logs
Next
From: "Andrey V. Lepikhov"
Date:
Subject: Re: Increase value of OUTER_VAR