Avoid including vacuum.h in tableam.h and heapam.h.
Nathan Bossart <nathan@postgresql.org>
Avoid including vacuum.h in tableam.h and heapam.h. Commit 2252fcd427 modified some function prototypes in tableam.h and heapam.h to take a VacuumParams argument instead of a pointer, which required including vacuum.h in those headers. vacuum.h has a reasonably large dependency tree, and headers like tableam.h are widely included, so this is not ideal. To fix, change the functions in question to accept a "const VacuumParams *" argument instead. That allows us to use a forward declaration for VacuumParams and avoid including vacuum.h. Since vacuum_rel() needs to scribble on the params argument, we still pass it by value to that function so that the original struct is not modified. Reported-by: Andres Freund <andres@anarazel.de> Reviewed-by: Andres Freund <andres@anarazel.de> Reviewed-by: Michael Paquier <michael@paquier.xyz> Discussion: https://postgr.es/m/rzxpxod4c4la62yvutyrvgoyilrl2fx55djaf2suidy7np5m6c%403l2ln476eadh
Files
| Path | Change | +/− |
|---|---|---|
| contrib/dblink/dblink.c | modified | +1 −0 |
| contrib/tablefunc/tablefunc.c | modified | +1 −0 |
| src/backend/access/heap/vacuumlazy.c | modified | +23 −23 |
| src/backend/catalog/toasting.c | modified | +1 −0 |
| src/backend/commands/analyze.c | modified | +13 −13 |
| src/backend/commands/cluster.c | modified | +2 −2 |
| src/backend/commands/event_trigger.c | modified | +1 −0 |
| src/backend/commands/vacuum.c | modified | +20 −20 |
| src/backend/postmaster/autovacuum.c | modified | +1 −1 |
| src/backend/replication/logical/conflict.c | modified | +1 −0 |
| src/backend/replication/logical/worker.c | modified | +1 −0 |
| src/backend/utils/adt/ri_triggers.c | modified | +2 −0 |
| src/include/access/heapam.h | modified | +6 −6 |
| src/include/access/tableam.h | modified | +4 −3 |
| src/include/commands/vacuum.h | modified | +3 −3 |
| src/pl/tcl/pltcl.c | modified | +1 −0 |
| src/tools/pgindent/typedefs.list | modified | +1 −0 |
Discussion
- Fixes inconsistent behavior in vacuum when it processes multiple relations 32 messages · 2025-06-18 → 2026-03-31