On 10/4/06, Beau Hartshorne <[EMAIL PROTECTED]> wrote: > > On 4-Oct-06, at 6:12 PM, Andy Dustman wrote: > > > I'm not sure this will fix your problem, but it might from my reading > > of the code. Try reversing the order of the filter() and extra() > > methods, i.e. > > > > qs = Place.objects.all().extra(select={'relevance': match_expr}, > > params=[query]).filter(name__search=query) > > That doesn't seem to fix it for me. The problem seems to be that the > code strips all of the column names when it does the SELECT COUNT(*), > but doesn't strip the parameters from the list it passes to execute > (). It breaks even without any other filters. > > A simpler example might be something like: > > >>> qs = Place.objects.all().extra(select={'hello': '%s'}, params= > ['world',]) > >>> qs.count() > Traceback (most recent call last): > File "<console>", line 1, in ? > File "/Library/Frameworks/Python.framework/Versions/2.4/lib/ > python2.4/site-packages/Django-0.95-py2.4.egg/django/db/models/ > query.py", line 202, in count > cursor.execute("SELECT COUNT(*)" + sql, params) > File "/Library/Frameworks/Python.framework/Versions/2.4/lib/ > python2.4/site-packages/Django-0.95-py2.4.egg/django/db/backends/ > util.py", line 19, in execute > self.db.queries.append({ > TypeError: not all arguments converted during string formatting
Oh, *that's* interesting. It's not really execution of the query that's causing the problem but the debug code that retains all executed queries. Although the execution could be raising the same exception: The part we are seeing above is in a finally clause. You may have to examine your local variables in that last frame to see what the values of sql and params are, and that may make the problem more obvious. Use the little triangle on the left to open it up; apparently it's not completely obvious to everyone that they do something. -- This message has been scanned for memes and dangerous content by MindScanner, and is believed to be unclean. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~----------~----~----~----~------~----~------~--~---