Avoid using a correlated subquery that Greenplum doesn't support, per report from...
authordpage <dpage@a7884b65-44f6-0310-8a51-81a127f17b15>
Fri, 12 Oct 2007 15:38:59 +0000 (15:38 +0000)
committerdpage <dpage@a7884b65-44f6-0310-8a51-81a127f17b15>
Fri, 12 Oct 2007 15:38:59 +0000 (15:38 +0000)
git-svn-id: svn://svn.pgadmin.org/trunk/pgadmin3@6742 a7884b65-44f6-0310-8a51-81a127f17b15

CHANGELOG
pgadmin/agent/pgaJob.cpp

index 9e90ed96d0b6b11ebebf443d9847a998e6b22296..3a92b28ee9d983f57f5e69bd2346a0277d565659 100644 (file)
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -36,9 +36,10 @@ Changes
 \r
 Date       Dev Ver    Change details\r
 ---------- --- -----  --------------\r
-2007-10-05 HS  1.8.0  Fixed new VIEW creation conditions.\r
+2007-10-12 DP  1.8.0  Avoid using a correlated subquery that Greenplum doesn't\r
+                      support, per report from Jon Roberts.\r
 2007-09-24 DP  1.8.0  Allow GUCs to be set on functions in PostgreSQL 8.3 and\r
-                      above [Guillaume Lelarge]\r
+                      above. [Guillaume Lelarge]\r
 2007-09-24 DP  1.8.0  Allow GUCs to be set on users, roles and databases at\r
                       create time.\r
 2007-09-03 DP  1.8.0  Fix the table, index and index constraint tablespace\r
index bee2ce59879328bfa64eddfd7a673aad5954616d..1f36c4dfc63e99c026ebc768ca2a22269bfc94f8 100644 (file)
@@ -115,13 +115,15 @@ pgObject *pgaJobFactory::CreateObjects(pgCollection *collection, ctlTree *browse
     pgaJob *job=0;
 
     pgSet *jobs= collection->GetConnection()->ExecuteSet(
-       wxT("SELECT *, ")
-          wxT("(SELECT jlgstatus FROM pgagent.pga_joblog jl WHERE jl.jlgjobid = j.jobid ORDER BY jlgid DESC LIMIT 1) AS joblastresult ")
-          wxT("FROM pgagent.pga_job j\n")
-       wxT("  JOIN pgagent.pga_jobclass cl ON cl.jclid=jobjclid\n")
-       wxT("  LEFT OUTER JOIN pgagent.pga_jobagent ag ON ag.jagpid=jobagentid\n")
+       wxT("SELECT j.*, cl.*, ag.*, sub.jlgstatus ")
+       wxT("  FROM pgagent.pga_job j JOIN")
+       wxT("  pgagent.pga_jobclass cl ON cl.jclid=jobjclid LEFT OUTER JOIN")
+       wxT("  pgagent.pga_jobagent ag ON ag.jagpid=jobagentid JOIN")
+       wxT("  (SELECT DISTINCT ON (jlgjobid) jlgstatus, jlgjobid")
+       wxT("   FROM pgagent.pga_joblog")
+       wxT("  ORDER BY jlgjobid, jlgid desc) sub ON sub.jlgjobid = j.jobid ")
        + restriction +
-       wxT(" ORDER BY jobname"));
+       wxT("ORDER BY jobname;"));
 
     if (jobs)
     {