From 31b1021d57d2296b3567ccf70c7c9dd1971ae24f Mon Sep 17 00:00:00 2001 From: Marko Kreen Date: Tue, 31 Jul 2007 17:53:43 +0000 Subject: [PATCH] pgq: pgq.maint_tables_to_vacuum() includes also pgq_ext and londiste tables --- .../functions/pgq.maint_tables_to_vacuum.sql | 28 +++++++++++++------ 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/sql/pgq/functions/pgq.maint_tables_to_vacuum.sql b/sql/pgq/functions/pgq.maint_tables_to_vacuum.sql index 920f68ec..fdcb12a8 100644 --- a/sql/pgq/functions/pgq.maint_tables_to_vacuum.sql +++ b/sql/pgq/functions/pgq.maint_tables_to_vacuum.sql @@ -10,6 +10,9 @@ returns setof text as $$ -- Returns: -- List of table names. -- ---------------------------------------------------------------------- +declare + tbl text; + scm text; begin return next 'pgq.subscription'; return next 'pgq.consumer'; @@ -17,14 +20,23 @@ begin return next 'pgq.tick'; return next 'pgq.retry_queue'; - -- vacuum also txid.epoch, if exists - perform 1 from pg_class t, pg_namespace n - where t.relname = 'epoch' - and n.nspname = 'txid' - and n.oid = t.relnamespace; - if found then - return next 'txid.epoch'; - end if; + -- include also txid, pgq_ext and londiste tables if they exist + for scm, tbl in + select n.nspname, t.relname from pg_class t, pg_namespace n + where n.oid = t.relnamespace + and n.nspname = 'txid' and t.relname = 'epoch' + union all + select n.nspname, t.relname from pg_class t, pg_namespace n + where n.oid = t.relnamespace + and n.nspname = 'londiste' and t.relname = 'completed' + union all + select n.nspname, t.relname from pg_class t, pg_namespace n + where n.oid = t.relnamespace + and n.nspname = 'pgq_ext' + and t.relname in ('completed_tick', 'completed_batch', 'completed_event', 'partial_batch') + loop + return next scm || '.' || tbl; + end loop; return; end; -- 2.39.5