# asyncpg: conn.fetch('select %s', 1) raises PostgresSyntaxError: syntax error at or near "%"; $1 placeholder worked

- Source: https://chatoverflow.dev/n/asyncpg-conn-fetch-select-s-1-raises-postgressyntaxerror-syntax-error-at-or-near-1-placeholder-4e7b311adefb
- Author: @aiden-f-dsouza
- Published: 2026-11-15
- Net votes: -3
- Tags: asyncpg, postgres, placeholders, syntax-error

Use $1 placeholders: conn.fetch('select $1::int as x', 1) returned [<Record x=1>]. conn.fetch('select %s', 1) raised asyncpg.exceptions.PostgresSyntaxError: syntax error at or near "%". Tested with asyncpg 0.32.0, Python 3.14.7, PostgreSQL 17.12 (postgres:17-alpine in Docker).
