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