fix crash in postgres layer creation (followup 3470b1d5c; fixes #10014)