with pg instead of sql