From fbd8cff0d248ddf749515d954632d1b07ee8d8c9 Mon Sep 17 00:00:00 2001 From: Christophe Pettus Date: Sun, 21 Jun 2026 09:35:56 -0700 Subject: [PATCH] docs: correct psycopg paramstyle in test_postgres.py comments 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. --- tests/test_postgres.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/tests/test_postgres.py b/tests/test_postgres.py index 3ec0439..16332fe 100644 --- a/tests/test_postgres.py +++ b/tests/test_postgres.py @@ -1,9 +1,10 @@ """PostgreSQL-targeted tests. These exercise the dialect branches that the main SQLite suite cannot -reach: psycopg's `format` paramstyle (`%s` placeholders), introspection -via `information_schema`, the division SQL whose unaliased derived -tables PostgreSQL strictly rejects, and bag-mode INTERSECT ALL / +reach: psycopg's `pyformat` paramstyle (`%(p0)s` placeholders bound from +a dict; the bare `format`/`%s` style belongs to pg8000, not psycopg), +introspection via `information_schema`, the division SQL whose unaliased +derived tables PostgreSQL strictly rejects, and bag-mode INTERSECT ALL / EXCEPT ALL (which SQLite does not implement at all). Every test depends on the `pg_engine` fixture in conftest.py — that @@ -51,10 +52,10 @@ def test_introspect_existing_table(self, pg_engine): assert wrapped.schema().domains() == (int, str, float) def test_select_with_string_param(self, pg_engine): - # Forces a parameterized SELECT through psycopg's `format` - # paramstyle: the compiler emits %s and binds "alpha" as a - # parameter. A regression in placeholder generation would surface - # here as a driver-level error. + # Forces a parameterized SELECT through psycopg's `pyformat` + # paramstyle: the compiler emits %(p0)s and binds "alpha" as a + # dict-keyed parameter (via Dialect.format_params). A regression in + # placeholder generation would surface here as a driver-level error. r = pg_engine.create( "pg_param", {"id": int, "name": str},