RE: [PATCH] Tiny optmization or a bug?

From: Ranier Vilela <ranier_gyn(at)hotmail(dot)com>
To: "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:34:45
Message-ID: MN2PR18MB2927B11A2763DB86FB2A1876E3490@MN2PR18MB2927.namprd18.prod.outlook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,
I just wanted to help a little bit, sorry for the out balls.

Maybe, I got one or two right.

Anyway, thank you very much for your attention and patience.

best regards.
Ranier Vilela

________________________________________
De: Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com>
Enviado: sexta-feira, 22 de novembro de 2019 23:25
Para: Ranier Vilela
Cc: pgsql-hackers(at)postgresql(dot)org
Assunto: Re: [PATCH] Tiny optmization or a bug?

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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Nikita Glukhov 2019-11-22 23:35:50 Re: Avoid full GIN index scan when possible
Previous Message Tomas Vondra 2019-11-22 23:25:33 Re: [PATCH] Tiny optmization or a bug?