Add new Postgres schema to search path


Speaking of things I always, always forget for some reason, use this to put a new schema in your search path:

SET search_path TO schema;

From the PostgreSQL docs:

When objects are referenced in any other context without schema qualification (table modification, data modification, or query commands) the search path is traversed until a matching object is found. Therefore, in the default configuration, any unqualified access again can only refer to the public schema.

I guess I don’t need it often enough to commit to memory. Conversely, I still reference the non-existant DUAL table even though I haven’t touched an Oracle DB for almost a decade.

Author bio and support


Ruben Schade is a technical writer and infrastructure architect in Sydney, Australia who refers to himself in the third person. Hi!

The site is powered by Hugo, FreeBSD, and OpenZFS on OrionVM, everyone’s favourite bespoke cloud infrastructure provider.

If you found this post helpful or entertaining, you can shout me a coffee or send a comment. Thanks ☺️.