powa-team / pg_qualstats

A PostgreSQL extension for collecting statistics about predicates, helping find what indices are missing
Other
272 stars 26 forks source link

cppcheck find bug #44

Closed RekGRpth closed 2 years ago

RekGRpth commented 2 years ago
pg_qualstats.c:741:15: style: Variable 'queryEntry' is assigned a value that is never used. [unreadVariable]
   queryEntry = (pgqsQueryStringEntry *) hash_search_with_hash_value(pgqs_query_examples_hash, &queryKey,
              ^
rjuju commented 2 years ago

This is not a bug.

What cppcheck complains about is that indeed this assignment isn't necessary, but it's entirely harmless. Performance wise it won't matter, and if it did it's quite likely that any recent compiler would optimize it.

Anyway thanks for the report, I will change it it as the real benefit from that will be to reduce the width of this block.

rjuju commented 2 years ago

Fixed with a lot of additional similar changes in https://github.com/powa-team/pg_qualstats/commit/36588438773168f9d3a2c1096e092e65500e63c5!