can someone please check if this fails with current SVN trunk?
#import psycopg2
#connection=psycopg2.connect("dbname='...' user='...'")
#cursor=connection.cursor()
#cursor.execute('''SELECT '%' ''') # Does not fail
#cursor.execute('''SELECT '%' ''', ()) # Does fail
from django.db import connection
cursor=connection.cursor()
cursor.execute('''SELECT '%' ''')
I get this traceback:
Traceback (most recent call last):
File "/localhome/modw/tmp/t.py", line 8, in <module>
cursor.execute('''SELECT '%s' ''')
File "/localhome/modw/django/db/backends/util.py", line 21, in execute
return self.cursor.execute(sql, params)
IndexError: tuple index out of range
This is because params is () and not None.
PS: I am not running the latest SVN snapshot, so maybe this bug
is already fixed.
--
Thomas Guettler, http://www.thomas-guettler.de/
E-Mail: guettli (*) thomas-guettler + de
This doesn't look like it's going to be any sort of problem with Django.
That error is coming from the psycopg2 module by the looks of things. I
think the solution here is "don't do that!". All cursor.execute() in
Django does is pass the query string and parameters through to the
appropriate Python-DB module.
Regards,
Malcolm