'Why do tables in postgresql get created in public schema despite a different search path?

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 ();


Solution 1:[1]

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

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 JGH