Add new Postgres schema to search path

Software

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

Me!

Ruben Schade is a technical writer and IaaS engineer in Sydney, Australia who refers to himself in the third person in bios. Wait, not BIOS… my brain should be EFI by now.

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

If you found this post helpful or entertaining, you can shout me a coffee or buy some silly merch. Thanks!