Fixed segments SQL queries for PostgreSQL compatibility
Merge pull request #422 from tucksaun/feat-postgresql-support

Fixed segments SQL queries for PostgreSQL compatibility