1

I had PostgreSQL 9.5 installed on the server. I removed all postgres packages with

sudo apt remove '^postgres'

Then I stopped systemd postgresql service, removed the following directories:

/var/lib/postgresql/
/var/log/postgresql/
/etc/postgresql/

Also removed postgres user:

sudo deluser postgres

Removed systemd service (don't remember where it was)

After that I tried to install PostgreSQL 10, and it didn't create new cluster for version 10.

When I tried to install PostgreSQL 10 from the same source (http://apt.postgresql.org/pub/repos/apt/) on fresh server, new cluster was created.

As far as I remember, when I installed PostgreSQL 10 next to PostgreSQL 9.5 (and upgrading it using pg_upgradecluster), new cluster was created.

So, under what circumstances installation of PostgreSQL, particularly version 10, includes creation of a new cluster?

1 Answer 1

0

The Debian/Ubuntu packages have a postinstall step that essentially calls configure_version() in /usr/share/postgresql-common/maintscripts-functions (from the postgresql-common package) to create a new cluster.

The tests done by this function determine whether it should create a new cluster:

if [ ! -d "/etc/postgresql/$VERSION" ] || [ -z "$(ls /etc/postgresql/$VERSION)" ] || \
   [ -z "$(ls /etc/postgresql/$VERSION/*/postgresql.conf 2>/dev/null)" ]; then
    # skip creating the main cluster when this is not the first install, or
    # when explicitly disabled ($create is on/off/"")
    create=$(pg_conftool /etc/postgresql-common/createcluster.conf show -bs create_main_cluster || :)
    if [ -z "$2" ] && [ "$create" != "off" ]; then
        set_system_locale
        pg_createcluster -u postgres $VERSION main ||

So if there wasn't a pre-existing /etc/postgresql/10 directory, the next reason for not creating a cluster would be that the configuration in /etc/postgresql-common/createcluster.conf denies it.

Otherwise it might be that the environment had an invalid locale, but there would be a warning output about it, such as in Locale warning from Perl stops Postgres configuring.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .