pgAgent is reporting that the job running this query:

insert into dba.pg_stat_bgwriter_data
(
select *, now() from pg_catalog.pg_stat_bgwriter
);

is failing with a return code of 1, despite having completed the insert ok.

When I wrap the code in a "do" statement, it reports success:

do $$
begin
insert into dba.pg_stat_bgwriter_data
(
select *, now() from pg_catalog.pg_stat_bgwriter
);
end;
$$ language plpgsql


I've been through the code, and the return of 1 is coming back from the number of rows inserted after ExecuteVoid so the logic following in job.cpp seems incorrect:

                wxString stepstatus;
                if (rc == 0)
                        stepstatus = wxT("s");
                else
                        stepstatus = steps->GetString(wxT("jstonerror"));

"rc" is coming back as the number of rows, so in this case; 1. I assume because the "do" statement returns 0 it's reporting ok.

pgAgent Version is:  pgAgent-3.2.0
OS is: CentOS 6.2
Jobs ran from: pgAdmin 1.14.3

If it's agreed that this is a bug, then I will have a go at a patch if I get time later today...

Cheers

Martin

============================================= Romax Technology Limited Rutherford House Nottingham Science & Technology Park Nottingham, NG7 2PZ England Telephone numbers: +44 (0)115 951 88 00 (main) For other office locations see: http://www.romaxtech.com/Contact ================================= =============== E-mail: info@romaxtech.com Website: www.romaxtech.com ================================= ================ Confidentiality Statement This transmission is for the addressee only and contains information that is confidential and privileged. Unless you are the named addressee, or authorised to receive it on behalf of the addressee you may not copy or use it, or disclose it to anyone else. If you have received this transmission in error please delete from your system and contact the sender. Thank you for your cooperation. =================================================