[DB-SIG] API 3.0 limiting paramstyle to ['named', 'qmark'] is okay. ('format' is not desirable)

Christoph Zwerschke cito at online.de
Fri May 17 19:06:26 CEST 2013

Am 17.05.2013 18:41, schrieb Daniele Varrazzo:
 > You have tested it wrong, and haven't bothered reading the first few
 > lines of the first page of the documentation of the driver library.

Yes, sorry for creating confusion today, I tested it wrong and psycopg2 
*does* add the quotes.

But then I wonder why you gave this example:

Select 'Guess how many params this query has?? ? ? %s'

Because if params must not be quoted this makes little sense.

How do you expect the command above to be executed by the driver? Should 
the parameters now appear without quotes because they are already in a 
literal string? At least psycopg2 quotes them anyway, so you would have 
double quotes and a syntax error. So I think it's safe to assume or 
require that parameters appear only outside of strings and then it's not 
ambiguous any more, because ? and : cannot appear in SQL outside quotes.

-- Chris

More information about the DB-SIG mailing list