This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author simon.jagoe
Recipients simon.jagoe
Date 2010-05-11.16:27:00
SpamBayes Score 0.00090367656
Marked as misclassified No
Message-id <1273595222.03.0.475415636905.issue8689@psf.upfronthosting.co.za>
In-reply-to
Content
I have been using sqlalchemy and sqlamp in a project for a while with Python 2.5.x and Python 2.6.4. With a recent upgrade to Python 2.6.5 (on Ubuntu Lucid Lynx), a particular operation began to fail when using sqlite.

I have tracked this to using the sqlite3 module and multiple parameter substitution. See below for a simple test case.

Set up the database:

 >>> import sqlite3
 >>> conn = sqlite3.connect('test.sqlite3')
 >>> c = conn.cursor()
 >>> c.execute('create table test (col integer)')
 >>> c.execute('insert into test values (1)')
 >>> conn.commit()

Actual result:

 >>> c.execute('SELECT coalesce(max(test.col), ?) + ? AS col FROM test', (0, 1))
 >>> c.fetchone()
 (None,)

Expected result:

 >>> c.execute('SELECT coalesce(max(test.col), ?) + ? AS col FROM test', (0, 1))
 >>> c.fetchone()
 (2,)

The expected result can be simulated like this:

 >>> c.execute('SELECT coalesce(max(test.col), 0) + 1 AS col FROM test')
 >>> c.fetchone()
 (2,)
History
Date User Action Args
2010-05-11 16:27:02simon.jagoesetrecipients: + simon.jagoe
2010-05-11 16:27:02simon.jagoesetmessageid: <1273595222.03.0.475415636905.issue8689@psf.upfronthosting.co.za>
2010-05-11 16:27:00simon.jagoelinkissue8689 messages
2010-05-11 16:27:00simon.jagoecreate