In our database we have users: A, B, C.
Each user has its own corresponding schema: A, B, C.
Normally if I wanted to select from a table in one of the schemas I would have to do:
select * from A.table;
My question is:
Is there a way to make:
select * from table
go to the correct schema based on the user that is logged in?
This is the default behavior for PostgreSQL. Make sure your
search_pathis set correctly.By default it should be:
See PostgreSQL’s documentation on schemas for more information. Specifically this part:
Update RE you comment:
Here is what happens on my machine. Which is what I believe you are wanting.