how setup pgagent step result
or output
show number of rows processed on function?
my function return number of rows affected, isnt value show in result
.
begin while int_pending > 0 loop ..... update table set .... diagnostics int_row_count = row_count; int_total = int_total + int_row_count; end loop; return int_total; end;
according source code of pgagent :
output = stepconn->getlasterror(); ... rc = threadconn->executevoid( wxt("update pgagent.pga_jobsteplog ") wxt(" set jslduration = now() - jslstart, ") wxt(" jslresult = ") + numtostr(rc) + wxt(", jslstatus = '") + stepstatus + wxt("', ") wxt(" jsloutput = ") + threadconn->qtdbstring(output) + wxt(" ") wxt(" jslid=") + jslid);
pgagent stores last error of of job step execution.
so, there 2 ways implement desired behaviour:
- patch source code implement feature, recompile, install , use custom version
use
raise exception
inside plpgsql function, this:create or replace function test_output() returns void $$ declare rows int := 25; begin raise exception 'updated rows: %', rows; end; $$ language plpgsql;
Comments
Post a Comment