THis doesn't work, resulting in ERROR: relation "user" does not exist
select * from "user"
This one does
select * from "dbo"."user"
Tables that aren't schema-qualified are searched for on the search_path. This doesn't search every schema. By default it only searches:
pg_catalog (implicitly always first, not listed on search_path)pg_temp tablespaces (implicit, not listed on search_path)$user in search_pathpublic schemaIf you want PostgreSQL to look elsewhere you have to modify the search_path to tell it so, or fully schema-qualify the name.
See the PostgreSQL manual on search_path.
Also, note that unlike some databases the name dbo has no particular significance in PostgreSQL. It's just another name.
search_path is resolved at view creation time and "baked in" to the view. It's good practice to explicitly qualify your references in views and functions, rather than relying on the search path.search_path. However, after removing the schema from the search path, it looked like the view wasn't refactored... I unfortunately don't have time to test this hypothesis, thank you for the reply.
search_pathdoes not include thedboschema. What's the output ofSHOW search_path;?""$user",public"dbo?postgressearch_path. So you have to schema-qualify it. That's the point of having schemas.