‘public’ schema and Slony
While setting up Slony the other day I found this weird problem…
I had like 8 schemas in my database and no schema named as ‘public’ and while trying to setup Slony for that specific database, during the INIT cluster step it started giving problems like…
“No schema available to setup objects”
I had no idea that its just a case of not having ‘public’ schema in there and as soon as I added an empty public schema, everything seemed to work fine and I was able to setup 8 sets for my 8 schemas and replication worked nicely as well.
Update: Just found out the problem came as I have deleted the public schema but the user’s search_path was defaulting to ‘public’ and changing that fixed the problem.
–
Shoaib Mir
shoaibmir[@]gmail.com
Categories: PostgreSQL
public schema, Slony
Hi Shoaib,
Might be a good idea to make a feedback to the Slony team. Removing the public schema is a common practice these days.
Thanks.
–
Guillaume
I just did that on the Slony general list
Actually, it is not true that the public schema must exist. The real problem is that slony looks for a “default” schema, which is normally “public”.
So if you are installing slony as user slony_admin,
before slony can connect to a database, it is necessary that the database have a default schema!
To set the default schema for a database, connect to the database as slony_admin and set the search path to the schema.
eg: psql –d your_default_schema
alter user slony_admin set search_path to your_default_schema;
Now when you install slony as user slony_admin, you should have no problem.
Thanks for the response Melvin, I too figured out the same as I got a reply from Slony dev with the same reason.
I will update the post as well.