Nice catch!
Claude pointed out that a few contrib modules are also affected
(pgstattuple, pg_visibility, pageinspect and pgrowlocks)
I think the location is right for the COPY TO case, but maybe it would
be the best to handle all locations in the same patch(set)?
+ foreach_oid(child, children)
+ {
+ if (get_rel_persistence(child) != RELPERSISTENCE_PERMANENT)
Can we put this check in the existing loop above? And maybe the error
detail could also name the specific relation?