Unit tests for #20600. They require postgresql.