The suggestion to reuse existing ANALYZE internals, in particular examine_attribute(), makes sense. Leveraging that logic to determine whether analyzable attributes lack statistics should align the implementation more closely with core ANALYZE behavior and avoid re-defining missing-stats rules independently.[Thanks Sami for teaching me this as i am an new contributor:) ]
You'll find some useful code for the syscache lookups in attribute_stats_update() and extended_statistics_update() for determining if attributes and stats objects have matching stats.