Postgres schemas are common in all databases

72 views Asked by At

I created a postgres cluster with patroni. The schemas are common in all the databases. Any table created in a schema of one database, appears also in the same schema of all other databases. Creating a new schema in one database, creates the same schema in all other databases. Postgres version is 12.15 running on Oracle Linux 8. Is this a setting that I can turn off in order to separate the databases? I'm creating schemas and databases using pgAdmin4 7.1, I don't have experience with psql

The setup instructions I followed came from here https://www.techsupportpk.com/2020/02/how-to-create-highly-available-postgresql-cluster-centos-rhel-8.html I re-installed from scratch and the behavior is the same

2

There are 2 answers

0
Laurenz Albe On

Patroni uses PostgreSQL streaming replication, which keeps the standby server a faithful physical copy of the primary. So there is no way to avoid that if you create a table in a certain schema on the primary, that table will also be created in the same schema on the standby.

0
Kyriakos Kouramenos On

The error was in my pgbouncer configuration. In the databases section I had

* = host=192.168.10.1 port=5432 dbname=postgres

The correct configuration must have a different entry for each database, without the wildcard

postgres = host=192.168.10.1 port=5432 dbname=postgres
analytics = host=192.168.10.1 port=5432 dbname=analytics