Re: pgAgent reports failure upon success

From: "Martin French" <Martin(dot)French(at)romaxtech(dot)com>
To: Dave Page <dpage(at)pgadmin(dot)org>
Cc: pgadmin-support(at)postgresql(dot)org
Subject: Re: pgAgent reports failure upon success
Date: 2012-07-06 10:36:08
Message-ID: OFADEC17D7.B93BF89A-ON80257A33.0037A182-80257A33.003A3D3D@LocalDomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgadmin-support

Hi Dave,

That seems reasonable enough to me.

GetLastError only returns a wxString though, fed from PQerrorMessage so I guess it would be the string that would be tested for content?

Maybe passing the ExecStatusTypeinto a DBConn/DBResult member variable that could be tested would work better?

Thoughts? :)

Cheers

Martin

Dave Page ---06/07/2012 11:06:04---Hi On Fri, Jul 6, 2012 at 8:04 AM, Martin French

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

Date: 06/07/2012 11:06

Subject: Re: [pgadmin-support] pgAgent reports failure upon success

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

============================================= 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(at)romaxtech(dot)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. =================================================

In response to

Responses

Browse pgadmin-support by date

  From Date Subject
Next Message Craig Ringer 2012-07-06 11:04:02 Re: Posgres 9.1.4
Previous Message Dave Page 2012-07-06 10:05:59 Re: pgAgent reports failure upon success