fixed SQL Statements to be postgres compatible

Fixed the statements for pgsql

See #8