It seems to want either all dict keys to be referenced, or at least the keys to
be referenced by the query to be "before" any keys which aren't referenced.
But dicts are unordered so that's non deterministic ..

This was an issue while converting existing application from
pg.connect().query() to DB.query_formatted.  The previous query used % string
interpretation, which allows passing a dict with "extra" values.

>>> pg.DB().query_formatted('SELECT %(b)s::int', dict(a=1, b=1) ).getresult()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "pg.py", line 1705, in query_formatted
    command, parameters, types, inline))
  File "pg.py", line 1688, in query
    return self.db.query(command, args)
pg.ProgrammingError: ERROR:  could not determine data type of parameter $1

>>> pg.DB().query_formatted('SELECT %(a)s::int', dict(a=1, b=1) ).getresult()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "pg.py", line 1705, in query_formatted
    command, parameters, types, inline))
  File "pg.py", line 1688, in query
    return self.db.query(command, args)
pg.DatabaseError: ERROR:  bind message supplies 2 parameters, but prepared 
statement "" requires 1
_______________________________________________
PyGreSQL mailing list
[email protected]
https://mail.vex.net/mailman/listinfo.cgi/pygresql

Reply via email to