]> git.ipfire.org Git - thirdparty/psycopg.git/commitdiff
Add example about DDL statement with quoted parameter
authorDaniele Varrazzo <daniele.varrazzo@gmail.com>
Fri, 7 Jan 2022 01:54:25 +0000 (02:54 +0100)
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>
Fri, 7 Jan 2022 01:54:25 +0000 (02:54 +0100)
See #199.

docs/basic/from_pg2.rst

index 383cfb1a4e03d95579d49826839a72c486c62330..7f2986da746fd64209ff4c4a2da48b0105f096a9 100644 (file)
@@ -69,8 +69,12 @@ If this is not possible, you can use client-side binding using the objects
 from the `sql` module::
 
     >>> from psycopg import sql
+
     >>> conn.execute(sql.SQL("CREATE TABLE foo (id int DEFAULT {})").format(42))
 
+    # This will correctly quote the password
+    >>> conn.execute(sql.SQL("ALTER USER john SET PASSWORD {}").format(password))
+
 
 .. _multi-statements: