[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: plague-client list failing



On Thu, 2006-06-29 at 14:10 -0400, Dan Williams wrote:
> On Thu, 2006-06-29 at 10:56 -0700, Ian Burrell wrote:
> > Doing "plague-client list" fails with the following error:
> > 
> > Error: an error ocurred communicating with the server. '<Fault 1:
> > 'pg.DatabaseError:error \'ERROR:  expression
> > too complex\nDETAIL:  Nesting depth exceeds maximum expression depth
> > 10000.\nHINT:  Increase the configuration
> > parameter "max_expr_depth".\n\' in \'SELECT jobid, parent_uid,
> > starttime, endtime, arch, builder_addr, status,
> > builder_status FROM archjobs WHERE parent_uid=5 OR parent_uid=1 OR
> > parent_uid=3 OR parent_uid=6 OR parent_uid=9
> > 
> > The "OR parent_uid = " clauses go on for a few pages (something 226K).
> >  PostgreSQL has a limit of 10,000 clauses in an expression.  Limiting
> > the number of jobs selected would fix the problem.
> 
> Thanks for the report, I need to fix this server-side.  Should be using
> <> here if the numbers are contiguous.
> 
> Dan

It looks like an IN clause would be simpler.

Index: UserInterface.py
===================================================================
RCS file: /cvs/fedora/extras-buildsys/server/UserInterface.py,v
retrieving revision 1.62
diff -u -r1.62 UserInterface.py
--- UserInterface.py    24 Mar 2006 19:13:41 -0000  1.62
+++ UserInterface.py    29 Jun 2006 18:23:41 -0000
@@ -338,11 +338,8 @@

         # Mash all returned job UIDs into an SQL query to get all their
archjobs
         uids = ''
-        for job in jobs:
-            if len(uids) == 0:
-                uids = uids + "parent_uid=%d" % job['uid']
-            else:
-                uids = uids + " OR parent_uid=%d" % job['uid']
+        if jobs:
+            uids = 'parent_uid in (' + ','.join([ job['uid'] for job in
jobs ]) + ')'

         # Get all archjobs for this job
         if len(uids) > 0:



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]