Thread: Re: Simplify the logic a bit (src/bin/scripts/reindexdb.c)

Re: Simplify the logic a bit (src/bin/scripts/reindexdb.c)

From
Álvaro Herrera
Date:
On 2025-Feb-13, Ranier Vilela wrote:

> Hi.
> 
> Coverity complained about possible dereference null pointer
> in *reindex_one_database* function.
> That's not really true.
> But the logic is unnecessarily complicated.

Hmm, this code looks quite suspect, but I wonder if instead of (what
looks more or less like) a straight revert of cc0e7ebd304a as you
propose, a better fix wouldn't be to split get_parallel_object_list in
two: get_parallel_table_list for the DATABASE and SCHEMA cases, and
get_parallel_tabidx_list (or whatever) for the INDEX case.  In the first
case we just return a list of values, but in the latter case we also
meddle with the input list which becomes an output list ...

-- 
Álvaro Herrera        Breisgau, Deutschland  —  https://www.EnterpriseDB.com/
¡Ay, ay, ay!  Con lo mucho que yo lo quería (bis)
se fue de mi vera ... se fue para siempre, pa toíta ... pa toíta la vida
¡Ay Camarón! ¡Ay Camarón!                                (Paco de Lucía)



Re: Simplify the logic a bit (src/bin/scripts/reindexdb.c)

From
Ranier Vilela
Date:
Hi Álvaro.

Em qui., 13 de fev. de 2025 às 18:38, Álvaro Herrera <alvherre@alvh.no-ip.org> escreveu:
On 2025-Feb-13, Ranier Vilela wrote:

> Hi.
>
> Coverity complained about possible dereference null pointer
> in *reindex_one_database* function.
> That's not really true.
> But the logic is unnecessarily complicated.

Hmm, this code looks quite suspect, but I wonder if instead of (what
looks more or less like) a straight revert of cc0e7ebd304a as you
propose, a better fix wouldn't be to split get_parallel_object_list in
two: get_parallel_table_list for the DATABASE and SCHEMA cases, and
get_parallel_tabidx_list (or whatever) for the INDEX case.  In the first
case we just return a list of values, but in the latter case we also
meddle with the input list which becomes an output list ...
Sure, I'll try to do it.

best regards,
Ranier Vilela

Re: Simplify the logic a bit (src/bin/scripts/reindexdb.c)

From
Ranier Vilela
Date:
Em sex., 14 de fev. de 2025 às 10:19, Ranier Vilela <ranier.vf@gmail.com> escreveu:
Em sex., 14 de fev. de 2025 às 09:13, Ranier Vilela <ranier.vf@gmail.com> escreveu:
Hi Álvaro.

Em qui., 13 de fev. de 2025 às 18:38, Álvaro Herrera <alvherre@alvh.no-ip.org> escreveu:
On 2025-Feb-13, Ranier Vilela wrote:

> Hi.
>
> Coverity complained about possible dereference null pointer
> in *reindex_one_database* function.
> That's not really true.
> But the logic is unnecessarily complicated.

Hmm, this code looks quite suspect, but I wonder if instead of (what
looks more or less like) a straight revert of cc0e7ebd304a as you
propose, a better fix wouldn't be to split get_parallel_object_list in
two: get_parallel_table_list for the DATABASE and SCHEMA cases, and
get_parallel_tabidx_list (or whatever) for the INDEX case.  In the first
case we just return a list of values, but in the latter case we also
meddle with the input list which becomes an output list ...
Sure, I'll try to do it.
Attached is the prototype version v1.
Any chance to push this forward?
Is it worth creating a committfest entry?

best regards,
Ranier Vilela

Re: Simplify the logic a bit (src/bin/scripts/reindexdb.c)

From
Álvaro Herrera
Date:
On 2025-Feb-21, Ranier Vilela wrote:

> Any chance to push this forward?
> Is it worth creating a committfest entry?

Yeah, I'll have a look.

-- 
Álvaro Herrera        Breisgau, Deutschland  —  https://www.EnterpriseDB.com/
"Entristecido, Wutra                     (canción de Las Barreras)
echa a Freyr a rodar
y a nosotros al mar"