From 0a42ca56746224034b4fff78cbfc7dec9eca2083 Mon Sep 17 00:00:00 2001 From: Daniele Varrazzo Date: Sat, 5 Dec 2020 00:52:05 +0000 Subject: [PATCH] Dropped erroneous statement that psycopg3 quotes values --- docs/params.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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 -- 2.47.2