title: Getting an error when creating a USER with a PASSWORD in PostgreSQL using psycopg2
body: <p>I am trying to create protected code which doesn't leave itself open for SQL Injection attacks. Currently, I want to create 3 users with different passwords. Here is what is looks like:</p>
  <pre><code>import psycopg2
  from psycopg2 import connect, extensions, sql
  # Importing a 0 integer so the process can pass without bothering w/ extensions
  from psycopg2.extensions import ISOLATION_LEVEL_AUTOCOMMIT
      
  user1 = &quot;jimmy&quot;
  user2 = &quot;ray&quot;
  user3 = &quot;billy&quot;
  secret1 = &quot;gelatto&quot;
  secret3 = &quot;cookies&quot;
  secret2 = &quot;vanilla&quot;
          
  cursor.execute(sql.SQL(&quot;CREATE USER {users} WITH PASSWORD {password}&quot;)
      .format(users=sql.Identifier(user1),
              password=sql.Identifier(secret1)))
  cursor.execute(sql.SQL(&quot;CREATE USER {users} WITH PASSWORD {password}&quot;)
      .format(users=sql.Identifier(user2),
              password=sql.Identifier(secret2)))
  cursor.execute(sql.SQL(&quot;CREATE USER {users} WITH PASSWORD {password}&quot;)
      .format(users=sql.Identifier(user3),
              password=sql.Identifier(secret3)))
  cursor.execute(sql.SQL(&quot;GRANT {role} TO {user}&quot;)
      .format(role=sql.Identifier(readWrite),
              user=sql.Identifier(user1)))
  cursor.execute(sql.SQL(&quot;GRANT {role} TO {user}&quot;)
      .format(role=sql.Identifier(readWrite),
              user=sql.Identifier(user2)))
  cursor.execute(sql.SQL(&quot;GRANT {role} TO {user}&quot;)
      .format(role=sql.Identifier(readOnly),
              user=sql.Identifier(user3)))
  </code></pre>
  <p>However, I receive an error to since the passwords are being closed in &quot; &quot; when they need to be ' '. Can anybody help me out on how they figured this out?</p>
  <pre><code>LINE 1: CREATE USER &quot;jimmy&quot; WITH PASSWORD &quot;gelatto&quot;
  </code></pre>