SQL and setType Bugfixes

Fixed a problem with a sql query on postgresql databases.
Fixed the "Did you remember to call setType() for 'name'?" warning.