Message-ID: From: "omeuid (@omeuid)" To: "postgresql-interfaces/psqlodbc" Date: Wed, 21 May 2025 14:56:44 +0000 Subject: [postgresql-interfaces/psqlodbc] issue #117: How to use PostgreSQL extended protocol with ODBC driver executing a parameterized sentence. List-Id: X-GitHub-Author-Id: 6940566 X-GitHub-Author-Login: omeuid X-GitHub-Issue: 117 X-GitHub-Repo: postgresql-interfaces/psqlodbc X-GitHub-State: open X-GitHub-Type: issue X-GitHub-Url: https://github.com/postgresql-interfaces/psqlodbc/issues/117 Content-Type: text/plain; charset=utf-8 Hi, Is there a way to configure the ODBC driver to use the extended protocol when running a parameterized query? Let's assume the following Python client. > import pyodbc > > def connect_to_odbc(uri): > conn = pyodbc.connect(uri) > return conn > > def execute_query(conn, query): > cursor = conn.cursor() > cursor.execute(query, 1) > result = cursor.fetchall() > return result > > uri = 'DSN=MyDSN' > > conn = connect_to_odbc(uri) > query = 'SELECT * from mytable where id = ?' > > result = execute_query(conn, query) > > for row in result: > print(row) > > conn.close() If the DSN is configured with 'server side prepare' option set to 1 (and also batch size is set to 1): * I expected that the driver would send P/B/E messages. * However, what I'm observing is that the driver only sends a Q message, with the parameter already replaced. Could you confirm if this is the expected behaviour? Is there anything that I can configure in the driver in order to get the behaviour that I was expecting? Regards