Re: Crash in 9.4 Beta when partially collapsing left outer joins

From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: lists(at)benjamindsmith(dot)com
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Crash in 9.4 Beta when partially collapsing left outer joins
Date: 2014-09-09 07:50:40
Message-ID: CAB7nPqTxtUUR7B-+YNZspiQJ+KsUMkqONWdiXyKtyfAY6iT-Dg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, Sep 9, 2014 at 2:43 PM, Michael Paquier
<michael(dot)paquier(at)gmail(dot)com> wrote:
> Some bisecting is showing as well that the commit at the origin of the
> regression is f343a88.
The failure is caused by an assertion not happy since this commit:
frame #4: 0x0000000101d20670
postgres`generate_bitmap_or_paths(root=0x00007fd61d004d48,
rel=0x00007fd61c033a58, clauses=0x00007fd61d010200,
other_clauses=0x0000000000000000) + 480 at indxpath.c:1213
frame #5: 0x0000000101d1fc37
postgres`create_index_paths(root=0x00007fd61d004d48,
rel=0x00007fd61c033a58) + 1255 at indxpath.c:314
frame #6: 0x0000000101d1146b
postgres`set_plain_rel_pathlist(root=0x00007fd61d004d48,
rel=0x00007fd61c033a58, rte=0x00007fd61c033c88) + 75 at allpaths.c:397

While reading the code of this commit, I noticed that
extract_or_clause has added some logic for nested OR clauses: it
extracts their content and adds them directly to the list of
subclauses that are then used by generate_bitmap_or_paths, triggering
the assertion failure reported by the trace above.
The logic for nested OR is correct by reading it, hence why not simply
removing the assertion failing? The attached patch 1 does so.

Another approach would consist in removing the nested OR part and keep
the old assertion logic, like in the patch 2 attached, but this seems
like a no-go as f343a88 has actually improved nested OR tracking.
Thoughts?
Note: I added as well a regression tests in patch 1 as this is IMO the
correct approach, if that's considered as correct of course :)
--
Michael

Attachment Content-Type Size
0001_20140909_indxpath_assert_remove.patch text/x-patch 3.1 KB
0002_20140909_indxpath_assert_remove_nested.patch text/x-patch 1.0 KB

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Yossi Cohen 2014-09-09 09:44:10 Advisory lock grant order
Previous Message Vinayak 2014-09-09 06:46:32 Re: CONCAT function