timescale / timescaledb

An open-source time-series SQL database optimized for fast ingest and complex queries. Packaged as a PostgreSQL extension.
https://www.timescale.com/
Other
16.83k stars 852 forks source link

Fix coverity warning about null pointer dereference #6958

Closed svenklemm closed 1 month ago

svenklemm commented 1 month ago

While the coverity warning is a false positive since rte->relkind is always either RELKIND_RELATION or RELKIND_VIEW this might not hold always true. This patch changes the if check to an Ensure and removes some nesting in the function.

Disable-check: force-changelog-file

svenklemm commented 1 month ago

Might want to review with whitespace ignored as it doesnt handle the changed indentation very well.

fabriziomello commented 1 month ago

Do we need to backport it to 2.15.x?

svenklemm commented 1 month ago

Did you run coverity on 2.15.x? If the trigger is in 2.15.x then we should include it. But overall it's mostly cosmetic change so we could pull it in even if coverity doesnt complain on 2.15.x

fabriziomello commented 1 month ago

Did you run coverity on 2.15.x? If the trigger is in 2.15.x then we should include it. But overall it's mostly cosmetic change so we could pull it in even if coverity doesnt complain on 2.15.x

I didn't but the code that generated this coverity issue is present on 2.15.x branch so would be good to include it.