From: | Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com> |
---|---|
To: | Ranier Vilela <ranier_gyn(at)hotmail(dot)com> |
Cc: | "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: [PATCH] Tiny optmization or a bug? |
Date: | 2019-11-22 23:25:33 |
Message-ID: | 20191122232533.5getrmipxu2gtaxb@development |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Fri, Nov 22, 2019 at 11:06:53PM +0000, Ranier Vilela wrote:
>Hi,
>Hi,
>Maybe this is a real bug.
>
>The assignment has no effect, or forget dereferencing it?
>
>Best regards.
>Ranier Vilela
>
>--- \dll\postgresql-12.0\a\backend\optimizer\plan\initsplan.c Mon Sep 30 17:06:55 2019
>+++ initsplan.c Fri Nov 22 19:48:42 2019
>@@ -1718,7 +1718,7 @@
> relids =
> get_relids_in_jointree((Node *) root->parse->jointree,
> false);
>- qualscope = bms_copy(relids);
>+ bms_copy(relids);
> }
> }
> }
Seriously, how are you searching for those "issues"?
1) We're using qualscope in an assert about 100 lines down, and as coded
we need a copy of relids because that may be mutated (and reallocated to
a different pointer). So no, the assignment *has* effect.
2) bms_copy(relids) on it's own is nonsensical, because it allocates a
copy but just throws the pointer away (why making the copy at all).
Have you tried modifying this code and running the regression tests? If
not, try it.
$ ./configure --enable-cassert
$ make
$ make check
Please, consider the suggestions from my previous response ...
regards
--
Tomas Vondra http://www.2ndQuadrant.com
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
From | Date | Subject | |
---|---|---|---|
Next Message | Ranier Vilela | 2019-11-22 23:34:45 | RE: [PATCH] Tiny optmization or a bug? |
Previous Message | Tom Lane | 2019-11-22 23:25:25 | Re: Assertion failing in master, predicate.c |