MagicStack / asyncpg

A fast PostgreSQL Database Client Library for Python/asyncio.
Apache License 2.0
6.98k stars 403 forks source link

Table Variable not working #705

Closed ghost closed 3 years ago

ghost commented 3 years ago

playerid = str(re.search(r'id=(.*?)=', line).group(1)) dbservice = f"service{service_id}" await self.bot.pg_con.execute("SELECT * FROM $1 WHERE dayz_id = $2", dbservice,player_id)

I keep getting following error when using a variable: asyncpg.exceptions.PostgresSyntaxError: syntax error at or near "$1"

elprans commented 3 years ago

Variables can only be used to pass data values, not parts of the query.