Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 20 Oct 2019 23:22:52 -0700
From:      David Newman <dnewman@networktest.com>
To:        freebsd-questions@freebsd.org
Subject:   changing the PostgreSQL default user
Message-ID:  <9fdcf15e-2f83-1cfd-1e04-cc08943485fa@networktest.com>

next in thread | raw e-mail | index | archive | help
Greetings.

FreeBSD recently changed its default version of PostgreSQL from 9.5 to 11.

However, attempts to run 'pg_upgrade' on the databases failed for me
because my 9.5 install had a default user of 'pgsql' and version 11 goes
with 'postgres' instead [1].

My hack was to edit /usr/local/etc/rc.d/postgresql, set postgresql_user
to pgsql, (re)run initdb, and then do the pg_upgrade conversion. It
works, but future upgrades might clobber the edit in the rc.d file.

This article suggests one ALTER command will change the default
PostgreSQL user:

https://netnow.jira.com/wiki/spaces/PUBP/pages/119996467/Changing+the+default+user+and+password+for+postgreSQL

Is that, plus chown'ing the data directory, sufficient to effect a name
change?

Thanks!

dn


[1] The pg_upgrade program has a -U switch to specify user, but it still
fails because the pgsql user can't read stuff owned by the postgres user
and vice-versa. Just running chown on either binary or data directory
and its contents doesn't work.






Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?9fdcf15e-2f83-1cfd-1e04-cc08943485fa>