Postgres Sql Using Cursor Update Current