Q:

Postgre's and pyodbc's booleans are incompatible?

I'm using pyodbc 3.0.10 and PostgreSQL 9.6, using the native Postgre odbc driver (Postgre Unicode (x64)). I've created a test table
create table test ( col boolean )

And I tried to insert a Python boolean. I can't see what parameter substitution was done, but doesn't seem like pyodbc works with all Postgre datatypes?
In [3]: cur = cxn.cursor()

In [4]: cur.execute('insert into test values (?)', (True,))
---------------------------------------------------------------------------
ProgrammingError                          Traceback (most recent call last)
<ipython-input-4-5a0edc50457d> in <module>()
----> 1 cur.execute('insert into test values (?)', (True,))

ProgrammingError: ('42804', '[42804] ERROR: column "col" is of type boolean but
expression is of type "char";\nError while preparing parameters (1) (SQLExecDirectW)')

A:

As Gord Thompson pointed out above, all you have to do is add ;BoolsAsChar=0 to the connection string

