pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Euler Taveira <euler@eulerto.com>
To: dan-eli@mail.ru
To: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #18868: /src/backend/optimizer/path/joinrels.c list_head can be NULL
Date: Wed, 26 Mar 2025 11:27:43 -0300
Message-ID: <ef3e2fb6-dfb7-49e6-ac62-53625d5ac7f2@app.fastmail.com> (raw)
In-Reply-To: <18868-76a65f10dd526ee5@postgresql.org>
References: <18868-76a65f10dd526ee5@postgresql.org>

On Wed, Mar 26, 2025, at 7:16 AM, PG Bug reporting form wrote:
> Pointers, returned from function 'list_head' at joinrels.c:1527 and 1528,
> may be NULL and is dereferenced at joinrels.c:1550 and 1551.

joinrels.c:

    compute_partition_bounds(root, rel1, rel2, joinrel, parent_sjinfo,
                             &parts1, &parts2);

    if (joinrel->partbounds_merged)
    {    
        lcr1 = list_head(parts1);
        lcr2 = list_head(parts2);
    }    

Did you read compute_partition_bounds()?

        if (joinrel->partbounds_merged)
        {
            get_matching_part_pairs(root, joinrel, rel1, rel2,
                                    parts1, parts2);
            Assert(list_length(*parts1) == joinrel->nparts);
            Assert(list_length(*parts2) == joinrel->nparts);
        }

parts1 and parts2 uses the same condition. I expect that if there is any bug
related to pointer deference, the assert(s) should report. Do you have a test
case that exposes this issue?


--
Euler Taveira
EDB   https://www.enterprisedb.com/

view thread (2+ messages)

Message-ID: <ef3e2fb6-dfb7-49e6-ac62-53625d5ac7f2@app.fastmail.com>
Permalink:  ../ef3e2fb6-dfb7-49e6-ac62-53625d5ac7f2@app.fastmail.com/
Also on:    postgresql.org/message-id/ef3e2fb6-dfb7-49e6-ac62-53625d5ac7f2@app.fastmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: euler@eulerto.com, dan-eli@mail.ru, pgsql-bugs@lists.postgresql.org
  Subject: Re: BUG #18868: /src/backend/optimizer/path/joinrels.c list_head can be NULL
  In-Reply-To: <ef3e2fb6-dfb7-49e6-ac62-53625d5ac7f2@app.fastmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox