This thread is an offshoot of https://www.postgresql.org/message-id/flat/CA+TgmoYqMtWb4zLUkT98oFnEkJ=wz0pw-ggdjrp9wnsxpzu...@mail.gmail.com covering the refactoring we wanted to do but lacked the time to get it done in v19.
The big changes from the previous effort are: 1. Instead of having separate per-stat parameters, or a shorted stat-only array of NullableDatum (thus requiring a separate index of datums, or some offset), instead we're just going to accept that the _internal function will ignore the first few elements of the NullableDatum array, specifically the ones concerning the object identification parameters that have already been checked/used/resolved. This removes the need for a second enum to index the shorter array, which in turn removes the need to rename the enum values. 2. The wrapper functions around the recovery check and locking were not implemented, and so the *_update() functions were not removed, and so the the renaming of the *_update_internal() functions to the name of the recently vacated *_update() function is not done either. I think this leaves the _update() functions rather "thin" in what they do, but that gives us a chance to review how much further we want to go. The function attribute_statistics_update() is called in only by pg_restore_attribute_stats, and therefore could be entirely folded into that function. However, removing relation_statistics_update() would result in that code being duplicated in pg_restore_relation_stats() and pg_clear_relation_stats(), so that's less of a win without the stat_util wrapper function. 0001-0003 phase out the use of FunctionCallInfo in any place where a simple NullableDatum array would suffice. It's still in 3 parts to make each change easier to see. 0004-0005 are the removal of "version" as a special parameter. They are strictly speaking outside the scope of $SUBJECT, so its fine if they don't get addressed in this thread.
v1-0003-Change-stats_fill_fcinfo_from_arg_pairs-to-Nullab.patch
Description: Binary data
v1-0005-Remove-check-and-ignore-of-version-parameter-in-s.patch
Description: Binary data
v1-0002-Make-internal-statistics_update-functions-stop-us.patch
Description: Binary data
v1-0001-Convert-stats_check-functions-from-fcinfo-to-Null.patch
Description: Binary data
v1-0004-Have-pg_clear_extended_stats-use-its-own-StatsArg.patch
Description: Binary data
