Closed cmflynn closed 2 years ago
it's probably because you can't use prepared statements for SET queries, not really an issue with buildpg.
If you trust the value of identify
, you can do something like
await pool.execute_b('set session iam.identity = :ident', ident=RawDangerous(identity))
But this is no more secure from a SQL injection point of view than
await pool.execute_b(f'set session iam.identity = {identity}')
I've been trying to find a way to pass params into asyncpg SET query. Can this library support that? Heres the example I tried, which fails with
asyncpg.exceptions.PostgresSyntaxError: syntax error at or near "$1"