pg_cron for vacuum - dynamic table set - Mailing list pgsql-general

From saket bansal
Subject pg_cron for vacuum - dynamic table set
Date
Msg-id CACkcRNiuyVkDJBEQg+u6sG=CA5-b73Jx1bzCVZO_dvacNfKMag@mail.gmail.com
Whole thread Raw
Responses Re: pg_cron for vacuum - dynamic table set  (Adrian Klaver <adrian.klaver@aklaver.com>)
Re: pg_cron for vacuum - dynamic table set  ("David G. Johnston" <david.g.johnston@gmail.com>)
Re: pg_cron for vacuum - dynamic table set  (Ron <ronljohnsonjr@gmail.com>)
List pgsql-general
Hi, I am trying to schedule pg_cron to generate a set of commands and then run them. E.g select 'vacuum freeze '||table_name from inventory_for_vacuum \gexec . This works well at command line, but when scheduled in pg_cron, it fails with syntax error ERROR: syntax error at or near "\" .
Since vacuum doesn't work inside a transaction block ERROR: VACUUM cannot run inside a transaction block, I cannot use a function directly to run over a loop.
Any guidance to make it work or an alternative?


pgsql-general by date:

Previous
From: Shaozhong SHI
Date:
Subject: Re: Regular Expression For Duplicate Words
Next
From: Adrian Klaver
Date:
Subject: Re: pg_cron for vacuum - dynamic table set