Обсуждение: Possible fault with resolve column name (plpgsql)

Поиск
Список
Период
Сортировка

Possible fault with resolve column name (plpgsql)

От
Ranier Vilela
Дата:
Hi,

Found by llvm scan build.
Argument with 'nonnull' attribute passed nullpl/plpgsql/src/pl_comp.cresolve_column_ref

Proceed?

regards,
Ranier Vilela
Вложения

Re: Possible fault with resolve column name (plpgsql)

От
Tom Lane
Дата:
Ranier Vilela <ranier.vf@gmail.com> writes:
> Found by llvm scan build.
> Argument with 'nonnull' attribute passed null pl/plpgsql/src/pl_comp.c
> resolve_column_ref

This is somewhere between pointless and counterproductive.  colname won't
be used unless the switch has set nnames_field (and the identified number
of names matches that).  If that logic somehow went wrong, I'd *want*
the later strcmp to dump core, not possibly give a false match.

            regards, tom lane



Re: Possible fault with resolve column name (plpgsql)

От
Ranier Vilela
Дата:
Em qui., 16 de set. de 2021 às 17:05, Tom Lane <tgl@sss.pgh.pa.us> escreveu:
Ranier Vilela <ranier.vf@gmail.com> writes:
> Found by llvm scan build.
> Argument with 'nonnull' attribute passed null pl/plpgsql/src/pl_comp.c
> resolve_column_ref

This is somewhere between pointless and counterproductive.
Not if you've ever used llvm scan, but it's pretty accurate in identifying what the condition might occur.
 
  colname won't
be used unless the switch has set nnames_field (and the identified number
of names matches that). 
13
Assuming field 'type' is equal to T_String
 
22
Assuming 'nnames' is equal to 'nnames_field'

If that logic somehow went wrong, I'd *want*
the later strcmp to dump core, not possibly give a false match.
In this case, strcmp will fail silently, without any coredump.

If we have a record, and the field is T_String, always have a true match?

regards,
Ranier Vilela