Hi Ilia Evdokimov,
While it's true that no arithmetic or logical operations are performed on queryid
after the assignment, the overflow technically occurs at the point of assignment itself. For example, entry->key.queryid
holds the value 12747288675711951805
as a uint64
, but after assigning it to queryid
(which is an int64
), it becomes -5699455397997599811
due to overflow.
This conversion is intentional - most likely to match the bigint type of the queryid column in pg_stat_statements. However, without an explicit comment, this can be misleading. A beginner reading this might misinterpret it as an unintentional overflow or bug and raise unnecessary concerns. Therefore, it’s worth adding a brief comment clarifying the intent behind this assignment.
Thanks & Regards,
Shaik Mohammad Mujeeb
Member Technical Staff
Zoho Corp