A PostgreSQL server instance manages one database cluster, which contains databases. Each connection enters exactly one database; schemas create namespaces inside it; schemas contain tables, views, sequences, functions, types, and other objects. Understanding this hierarchy prevents target mistakes, naming collisions, unsafe search_path behavior, and confused permission designs.
Connect to signaldesk_learning and confirm it with \conninfo.
Databases are strong connection boundaries. Ordinary queries cannot join tables across databases. Schemas are namespaces and permission boundaries inside one database. Roles are cluster-wide identities that can own objects and receive privileges.
In psql:
Backslash commands are client features. PostgreSQL itself exposes system catalogs and information-schema views:
Catalog queries are scriptable; psql meta-commands are convenient for humans.
Schema qualification—signaldesk.learning_check—states exactly which object you mean.
When a query says SELECT * FROM learning_check, PostgreSQL searches schemas listed in search_path. Inspect it:
Convenience becomes risk when an untrusted role can create objects in a searched schema. A malicious or accidental function with a familiar name could be resolved before the intended one. Production code should use controlled paths and schema qualification, especially in security-sensitive functions and migrations.
For this interactive session only:
Now learning_check resolves to the SignalDesk table. Reset with RESET search_path;.
AI-generated queries often omit schema qualification and may hallucinate object names. A model tool should expose a curated schema or narrow views, not every catalog and tenant table. Explicit namespaces also separate application truth, retrieval projections, evaluation records, and extension-owned objects without pretending they are different databases.
You should see learning_check. Then run \d+ signaldesk.learning_check and identify the identity default, primary-key index, not-null constraints, owner, and storage details.
Create another schema named sandbox with its own learning_check table. Insert a distinct note. Change search_path order and predict which unqualified table is selected, then verify.
Acceptance criterion: you correctly predict both resolutions and can make the query unambiguous without changing search_path.