Thread: [PATCH] Tiny optmization or a bug?
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); } } }
Attachment
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
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.vondra@2ndquadrant.com> Enviado: sexta-feira, 22 de novembro de 2019 23:25 Para: Ranier Vilela Cc: pgsql-hackers@postgresql.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