[PATCH] improve the pg_upgrade error message

From: Jeevan Ladhe <jeevan(dot)ladhe(at)enterprisedb(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: [PATCH] improve the pg_upgrade error message
Date: 2021-07-12 11:28:54
Message-ID: CAOgcT0McABqF_iFFQuuRf9is+gmYMsmUu_SWNikyr=2VGyP9Jw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

While looking into one of the pg_upgrade issue, I found it

challenging to find out the database that has the datallowconn set to

'false' that was throwing following error:

*"All non-template0 databases must allow connections, i.e. their
pg_database.datallowconn must be true"*

edb=# create database mydb;

CREATE DATABASE

edb=# update pg_database set datallowconn='false' where datname like 'mydb';

UPDATE 1

Now, when I try to upgrade the server, without the patch we get above

error, which leaves no clue behind about which database has datallowconn

set to 'false'. It can be argued that we can query the pg_database

catalog and find that out easily, but at times it is challenging to get

that from the customer environment. But, anyways I feel we have scope to

improve the error message here per the attached patch.

With attached patch, now I get following error:

*"All non-template0 databases must allow connections, i.e. their
pg_database.datallowconn must be true; database "mydb" has datallowconn set
to false."*

Regards,

Jeevan Ladhe

Attachment Content-Type Size
0001-Improve-the-pg_upgrade-error-message.patch application/octet-stream 878 bytes

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tomas Vondra 2021-07-12 11:44:42 Re: row filtering for logical replication
Previous Message Peifeng Qiu 2021-07-12 11:23:33 Re: Support kerberos authentication for postgres_fdw