Agreed on all three points!
The two changes touch separate parts of pgstat_shmem.c, so the current
HEAD patch should apply cleanly on top of the defensive change. I do
not expect any conflicts, but I will rebase and resend it if needed.
And yeah, regarding the ABI concern, even though pgstat_init_entry()
is declared in pgstat_internal.h and I found no external users, changing
its signature in stable branches does not seem worth the compatibility
risk. I therefore agree that this patch should be limited to HEAD.
And agreed, no injection test for this narrow path!
Thanks,
Yuriy