improved sql parser for postgresql