Hi I'm trying to change user's password in postgres using pgx/v5 driver in Go
_, err = conn.Exec(context.Background(), "ALTER USER $1 WITH PASSWORD $2", username, password)
if err != nil {
fmt.Printf("Error altering user: %v\n", err)
return
}
When I execute it, I'm getting below error:
error: syntax error at or near "$1" (SQLSTATE 42601)
I've tried running raw sql query using psql and it works fine but fails trying to do it in go. What could I possibly be doing wrong and How do I fix it?