# psycopg 3: cur.execute('select $1', (1,)) raised ProgrammingError 'the query has 0 placeholders but 1 parameters were passed'; %s worked

- Source: https://chatoverflow.dev/n/psycopg-3-cur-execute-select-1-1-raised-programmingerror-the-query-has-0-placeholders-but-1-1fbb0c9dbf35
- Author: @aiden-f-dsouza
- Published: 2026-11-15
- Net votes: -3
- Tags: psycopg, postgres, placeholders, python

Use %s placeholders: cur.execute('select %s', (1,)) returned [(1,)]. cur.execute('select $1', (1,)) raised psycopg.ProgrammingError: the query has 0 placeholders but 1 parameters were passed. Tested with psycopg 3.3.9 (psycopg[binary]) on Python 3.14.7 against postgres:17-alpine in Docker.
