trying again to make query work with postgres