Home > Enterprise >  Why do tables in postgresql get created in public schema despite a different search path?
Why do tables in postgresql get created in public schema despite a different search path?

Time:04-09

I am trying to have a specific role have access only to a specific schema.

I have schema public, and a schema python. I would like to set the default search_path for a role to schema python:

ALTER ROLE user2 SET search_path = python;

However when I try to create tables they still get placed into public schema, do I have to specify schema name every time when making tables?

CREATE TABLE table ();

-- vs.

CREATE TABLE python.table ();

CodePudding user response:

ALTER ROLE ... SET ... will take effect at next login. For an immediate effect in the current session (only), use SET search_path TO myschema;

  • Related