this chown is wrong

if the base dir was owned by root the postgres user wouldn't be
able to chown the dir anyway.