From: Daniele Varrazzo Date: Sat, 5 Dec 2020 00:52:05 +0000 (+0000) Subject: Dropped erroneous statement that psycopg3 quotes values X-Git-Tag: 3.0.dev0~281 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0a42ca56746224034b4fff78cbfc7dec9eca2083;p=thirdparty%2Fpsycopg.git Dropped erroneous statement that psycopg3 quotes values --- diff --git a/docs/params.rst b/docs/params.rst index d459985e7..7d22b5f12 100644 --- a/docs/params.rst +++ b/docs/params.rst @@ -92,14 +92,14 @@ query. cur.execute("INSERT INTO foo VALUES (%s)", ("bar",)) # correct cur.execute("INSERT INTO foo VALUES (%s)", ["bar"]) # correct -- The placeholder *must not be quoted*. Psycopg will add quotes where needed:: +- The placeholder *must not be quoted*:: - cur.execute("INSERT INTO numbers VALUES ('%s')", (10,)) # WRONG - cur.execute("INSERT INTO numbers VALUES (%s)", (10,)) # correct + cur.execute("INSERT INTO numbers VALUES ('%s')", ("Hello",)) # WRONG + cur.execute("INSERT INTO numbers VALUES (%s)", ("Hello",)) # correct - The variables placeholder *must always be a* ``%s``, even if a different placeholder (such as a ``%d`` for integers or ``%f`` for floats) may look - more appropriate for tye type. Another placeholder you can use is ``%b``, to + more appropriate for the type. Another placeholder you can use is ``%b``, to :ref:`adapt the object to binary type `:: cur.execute("INSERT INTO numbers VALUES (%d)", (10,)) # WRONG