Skip to content

docs: correct psycopg paramstyle in test_postgres.py comments - #10

Merged
Xof merged 1 commit into
mainfrom
fix/pg-paramstyle-comments
Jun 21, 2026
Merged

docs: correct psycopg paramstyle in test_postgres.py comments#10
Xof merged 1 commit into
mainfrom
fix/pg-paramstyle-comments

Conversation

@Xof

@Xof Xof commented Jun 21, 2026

Copy link
Copy Markdown
Collaborator

Fix incorrect psycopg paramstyle comments

Comment-only; corrects a comment/code mismatch flagged during the comment pass.

tests/test_postgres.py claimed the tests exercise psycopg's format
paramstyle (%s)
. That's wrong: psycopg 3.x (the [postgres] extra) reports
pyformat, so Dialect._detect_paramstyle returns "pyformat",
placeholder() emits %(p0)s, and format_params binds a dict — which
is exactly what engine.py's information_schema comment already documents
("psycopg3 (and psycopg2) report 'pyformat' … only pg8000 uses 'format'").

The tests always passed (pyformat works on psycopg); only the comments
misdescribed the mechanism. Fixed:

  • module docstring — pyformat / %(p0)s (dict-bound), and attributes the bare
    format/%s style to pg8000;
  • test_select_with_string_parampyformat / %(p0)s via
    Dialect.format_params.

No code or test behavior changed. Gate green: ruff, mypy, pytest
(119 passed, 15 skipped).

The module docstring and test_select_with_string_param described psycopg as
using the `format`/`%s` paramstyle, but psycopg 3.x reports `pyformat`: the
compiler emits `%(p0)s` and binds params from a dict (Dialect.format_params),
as engine.py's own information_schema comment already notes. `format`/`%s` is
pg8000's style, not psycopg's. Comment-only; the tests pass unchanged.
@Xof
Xof merged commit 7b2fda0 into main Jun 21, 2026
6 checks passed
@Xof
Xof deleted the fix/pg-paramstyle-comments branch June 21, 2026 16:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant