From 6551f3daa2567ea9b2ded9b467aa9d876cc4e77f Mon Sep 17 00:00:00 2001 From: Michael Paquier Date: Thu, 12 Jul 2018 13:50:17 +0900 Subject: [PATCH] Add assertion in expand_vacuum_rel() for non-autovacuum path The code path where the assertion is added helps to check that autovacuum always includes a relation OID when doing a vacuum on it. Extracted from a larger patch set to add support for SKIP LOCKED with manual VACUUM commands. Author: Nathan Bossart Discussion: https://postgr.es/m/9EF7EBE4-720D-4CF1-9D0E-4403D7E92990@amazon.com --- src/backend/commands/vacuum.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c index d90cb9a902..e16d8ef212 100644 --- a/src/backend/commands/vacuum.c +++ b/src/backend/commands/vacuum.c @@ -443,6 +443,12 @@ expand_vacuum_rel(VacuumRelation *vrel) Form_pg_class classForm; bool include_parts; + /* + * Since autovacuum workers supply OIDs when calling vacuum(), no + * autovacuum worker should reach this code. + */ + Assert(!IsAutoVacuumWorkerProcess()); + /* * We transiently take AccessShareLock to protect the syscache lookup * below, as well as find_all_inheritors's expectation that the caller -- 2.40.0