On Thu, 6 Apr 2023 at 16:04, Michael Paquier <michael@paquier.xyz> wrote:
> I have just seen this commit, and I am pretty sure that the checks
> have been placed in vacuum() to guard against incorrect option
> manipulations in the context of an autovacuum building the relations,
> so you are making this code weaker with the cross-checks it had, IMO.
> This is particularly relevant in some areas with toast relations, for
> example, because autovacuum handles the toast and their parents
> separately, contrary to ExecVacuum() that would group them together by
> default.
hmm, I'm not sure I agree that would warrant keeping ereport()s in
vacuum(). Autovacuum would have to set either VACOPT_FULL to possibly
trigger the first two moved ereport()s and the final 2 would need
VACOPT_ONLY_DATABASE_STATS. None of those are ever set by auto-vacuum,
so it seems unlikely that some logic somewhere like
relation_needs_vacanalyze().
Asserts() might be a good compromise.
David