Skip to content

PostgreSQL: System catalog modifications are currently disallowed

Today at a customer I faced this: “System catalog modifications are currently disallowed” which, honestly, I’ve never seen before. Why would someone try to modify the system catalogs, at least in a productive environment? It turned out to be pretty simple, but when I’ve seen this I was somehow lost. The command which was executed was:

postgres=# create extension pg_stat_statements;

Sometimes customers do things you just do not expect. In this case the whole deployment was Ansible driven and nobody really remembered what happens exactly. This is a downside of automation: If you blindly apply, in this case playbooks, you tend to forget what they are actually doing.

The first thing I’ve tried (and I should have read the error message in more detail) was to do the same in a psql session:

postgres=# create extension pg_stat_statements;
ERROR:  permission denied to create "pg_catalog.pg_stat_statements"
DETAIL:  System catalog modifications are currently disallowed.

Next thing I’ve tried was to create a simple table, just to be sure that at least this is working:

postgres=# create table t(a int);
ERROR:  permission denied to create "pg_catalog.t"
DETAIL:  System catalog modifications are currently disallowed.

Same error message. The point I’ve missed is that everything you need to know is in the error message, you just have to read it carefully. Why does PostgreSQL want to create that table, or the extension previously, in the the “pg_catalog” schema?

Questions about your own setup? A dbi services consultant can look at your case.

Talk to an expert (opens in a new tab)

And then it was pretty clear what happened:

postgres=# show search_path ;
    search_path     
--------------------
 pg_catalog, xx, yy
(1 row)

What they did, was to modify the search_path and putting “pg_catalog” in front of the list is not a good idea (this is anyway included by default, but not at the beginning). If you do that, PostgreSQL will try to create all objects there, and this will obviously fail.

Re-setting that to a more sane value resolved the issue.

Let’s work together

Ready to operate at
the next level?

Tell us about your challenge. We’ll bring the depth, the expertise, and the Swiss precision.

Open source Team

Open source Team

Posts published under the Open source Team account are collective contributions by the dbi services open infrastructure consultants. The practice covers open-source databases and platforms, PostgreSQL first of all, along with MySQL, MariaDB, and Linux, from architecture, replication, and high availability to performance tuning and operations under service level agreements, and contributes actively to the PostgreSQL community.View Author posts

721 posts since September 2011

Most read in Database

The Database posts our readers open most: the all-time favourites, and what is trending right now.

Leave a Comment

Your email address will not be published. Required fields are marked *