To create a user through psycopg2, I am using the following code :
cur=conn.cursor()
cur.execute("create user %s with password %s",('abcdefgh','0h/9warrAttrgd8EF0gkvQ==',))
This gives the following error :
syntax error at or near "'abcdefgh'" LINE 1: create user 'abcdefgh' with password '0h/9warrAttrgd8EF0gkvQ.
It seems that %s is placing quotes around the username, which postgres doesn't like while creating a user. The following code works fine :
cur.execute("create user abcdefgh with password %s",('0h/9warrAttrgd8EF0gkvQ==',))
Any workaround for this ?