我对 postgresql 很陌生,无法理解以下查询的作用,因此需要一些社区成员的帮助,他们可以向我解释这一点。
DO $$
DECLARE
jid integer;
scid integer;
BEGIN
-- Creating a new job
INSERT INTO pgagent.pga_job(
jobjclid, jobname, jobdesc, jobhostagent, jobenabled
) VALUES (
1::integer, 'backup'::text, ''::text, ''::text, true
) RETURNING jobid INTO jid;
-- Steps
-- Inserting a step (jobid: NULL)
INSERT INTO pgagent.pga_jobstep (
jstjobid, jstname, jstenabled, jstkind,
jstconnstr, jstdbname, jstonerror,
jstcode, jstdesc
) VALUES (
jid, 'backup'::text, true, 'b'::character(1),
''::text, ''::name, 'f'::character(1),
'set PGPASSWORD=password
pg_dump -h "localhost" -U "postgres" -f "D:\backup\backuppg_%date:~-4%_%date:~3,2%_%date:~0,2%__%time:~0,2%_%time:~3,2%_%time:~6,2%" "postgres"'::text, ''::text
) ;