Re: pgAgent reports failure upon success

From: Dave Page <dpage(at)pgadmin(dot)org>
To: Martin French <Martin(dot)French(at)romaxtech(dot)com>
Cc: pgadmin-support(at)postgresql(dot)org
Subject: Re: pgAgent reports failure upon success
Date: 2012-07-06 10:05:59
Message-ID: CA+OCxox428wAm-Sf_VEkFfQ7oxkJSgYjYjD0Z_sV9_SjJx3cwA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgadmin-support

Hi

On Fri, Jul 6, 2012 at 8:04 AM, Martin French
<Martin(dot)French(at)romaxtech(dot)com> wrote:
>
> 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.

Yeah, that is a bug; though I don't think the issue is in that code
snippet. I think it's here:

stepConn = DBconn::Get(jstconnstr, jstdbname);
if (stepConn)
{
LogMessage(wxString::Format(_("Executing SQL step %s (part of job
%s)"), stepid.c_str(), jobid.c_str()), LOG_DEBUG);
rc = stepConn->ExecuteVoid(steps->GetString(wxT("jstcode")));
output = stepConn->GetLastError();
stepConn->Return();
}

I think rc should be set to either 0 or -1, depending on whether an
error was returned, not based on the return value from ExecuteVoid.

Seem reasonable?

--
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Responses

Browse pgadmin-support by date

  From Date Subject
Next Message Martin French 2012-07-06 10:36:08 Re: pgAgent reports failure upon success
Previous Message Dave Page 2012-07-06 09:30:00 Re: Posgres 9.1.4