From: Tom Lane <tgl@sss.pgh.pa.us>
To: David Rowley <drowley@postgresql.org>
Cc: pgsql-committers@lists.postgresql.org
Subject: Re: pgsql: Fix planner's use of Result Cache with unique joins
Date: Sun, 23 May 2021 10:14:50 -0400
Message-ID: <457998.1621779290@sss.pgh.pa.us> (raw)
In-Reply-To: <E1lkJA3-0007te-6H@gemulon.postgresql.org>
References: <E1lkJA3-0007te-6H@gemulon.postgresql.org>
David Rowley <drowley@postgresql.org> writes:
> Fix planner's use of Result Cache with unique joins
Coverity is not happy with this:
/srv/coverity/git/pgsql-git/postgresql/src/backend/optimizer/path/joinpath.c: 532 in get_resultcache_path()
526 * determining if the join is unique.
527 *
528 * XXX this could be enabled if the remaining join quals were made part of
529 * the inner scan's filter instead of the join filter. Maybe it's worth
530 * considering doing that?
531 */
>>> CID 1484914: Null pointer dereferences (FORWARD_NULL)
>>> Dereferencing null pointer "inner_path->param_info".
532 if (extra->inner_unique &&
533 list_length(inner_path->param_info->ppi_clauses) <
534 list_length(extra->restrictlist))
535 return NULL;
536
This complaint is triggered because elsewhere in the same function,
you're careful to check for inner_path->param_info being null before
trying to dereference it:
if ((inner_path->param_info == NULL ||
inner_path->param_info->ppi_clauses == NIL) &&
innerrel->lateral_vars == NIL)
return NULL;
Coverity reasons that it's probably a bug that you didn't do the same
here; and I think it's right.
regards, tom lane
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-committers@postgresql.org
Cc: tgl@sss.pgh.pa.us, drowley@postgresql.org
Subject: Re: pgsql: Fix planner's use of Result Cache with unique joins
In-Reply-To: <457998.1621779290@sss.pgh.pa.us>
References: <E1lkJA3-0007te-6H@gemulon.postgresql.org> <457998.1621779290@sss.pgh.pa.us>
* 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