Home > PostgreSQL > ‘public’ schema and Slony

‘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

Advertisements
Categories: PostgreSQL Tags: ,
  1. Guillaume Smet
    April 8, 2009 at 7:58 pm

    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

  2. April 8, 2009 at 8:23 pm

    I just did that on the Slony general list

  3. Melvin Davidson
    April 10, 2009 at 3:23 am

    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.

  4. April 10, 2009 at 11:19 am

    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.

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: