Use colnames to order the returned result correctly

.colnames was only added in postgresql 9.2.  There is no way to ensure
the order of the columns without it, so skip the test if postgresql is
older than 9.2.
Return values from non select statements too

This includes insert, update and delete statements that contain
"RETURNING".
Directly insert NULL into the query if a variable is None
Get db connection and cursor to work with python "with"
Detect bytea type in py_param_to_pg_type and convert to right format

psycopg2 accepts buffer, memoryview, bytearray and bytes python types as
postgres bytea type.