kvstore: rewrite postgresqlkv

And fix a recent test-rewrite: the rewrite wasn't correct