More universal way is to set search_path (should work in PostgreSQL 7.x and above):

SET search_path TO myschema;

Note that set schema myschema is an alias to above command that is not available in 8.x.

See also: http://www.postgresql.org/docs/9.3/static/ddl-schemas.html

Answer from Nux on Stack Overflow
🌐
PostgreSQL
postgresql.org › docs › current › ddl-schemas.html
PostgreSQL: Documentation: 18: 5.10. Schemas
May 14, 2026 - The ability to create like-named objects in different schemas complicates writing a query that references precisely the same objects every time. It also opens up the potential for users to change the behavior of other users' queries, maliciously or accidentally. Due to the prevalence of unqualified names in queries and their use in PostgreSQL internals, adding a schema to search_path effectively trusts all users having CREATE privilege on that schema.
Discussions

Why is Postgre SQL asking me to specify a schema when I want to select a column?
Issue: show search_path; and check result. If you're using psql, then the situation is trivial to diagnose: \dt *.payment will tell you how many paymenbt tables, you have, and in which schemas. If the schema the table is in, is not in search_path - it will not be "found". You have to put the schema in search_path, or just always prefix table name with "schema." More on reddit.com
🌐 r/PostgreSQL
16
1
February 24, 2025
Specify Postgres schema
Unfortunately there is no way to parameterize a schema name in a query (see this SO thread). But you can pass a schema name as a connection parameter, which will set the search_path. More on github.com
🌐 github.com
4
3
August 18, 2023
postgresql - In Postgres 12, how do I set a default schema when logging in using psql? - Database Administrators Stack Exchange
I'm logging in to my Postgres 12 (running on Windows 10) db using an alias, which resolves to PGPASSWORD=$DB_PASSWORD psql -U${DB_USER} $DB_NAME I would like to find a way to tell Postgres which s... More on dba.stackexchange.com
🌐 dba.stackexchange.com
July 20, 2022
postgresql - Set deafult schema while querying in pgAdmin 4 with query tool - Stack Overflow
You can also set it for whole database, same way as for role. EDIT: Just to explain what this does - it will change where and in what order Postgres will search for objects matching object identifiers that did not get prefixed with schema name. ... Sign up to request clarification or add additional context in comments. ... Maybe SO is making me lazy. It didn't occur to me just try this in the Query ... More on stackoverflow.com
🌐 stackoverflow.com
🌐
Wordpress
asusualcoding.wordpress.com › 2024 › 04 › 25 › how-to-set-default-schema-in-postgres
How to set default schema in Postgres? – My coding exploration
April 25, 2024 - Basically we can set the default schema using SearchPath in the connection strings. We can define connection string in different formats. There are few as below. Host=<host_name>;Port=<port_no>;Database=<database_name>;User ID=<user_name>;P...
🌐
Squash
squash.io › executing-queries-in-postgresql-using-schemas
Executing Queries in PostgreSQL Using Schemas
October 30, 2023 - To switch between schemas in PostgreSQL, you can use the SET SCHEMA statement followed by the schema name. Here's an example: ... This statement sets the current schema to "sales".
🌐
Reddit
reddit.com › r/postgresql › why is postgre sql asking me to specify a schema when i want to select a column?
r/PostgreSQL on Reddit: Why is Postgre SQL asking me to specify a schema when I want to select a column?
February 24, 2025 -

For example I have a database with 2 schemas, public & shop and I want to select the table of a column

SELECT * FROM payment

and I get this error SQL state: 42P01

Yet if I use the Schema shop

SELECT * FROM shop.payment

There is no error,

Yet on other database that I am working with that has also 1 schema and public, yet I don't need to specify the schema name, why is this?

For example

SELECT * FROM payment

works perfectly in that database.

Why is this?

🌐
CommandPrompt Inc.
commandprompt.com › education › how-do-i-setchange-the-default-schema-in-postgresql
How Do I Set/Change the Default Schema in PostgreSQL — CommandPrompt Inc.
March 2, 2023 - So, by default, Postgres users can access the "public" schema and create objects in it, such as views, tables, etc. The SET SEARCH_PATH command, however, allows a user to set any other schema as the default schema.
Address   2950 Newmarket ST STE 101 - 231, 98226, Bellingham
🌐
PostgreSQL
postgresql.org › docs › current › sql-createschema.html
PostgreSQL: Documentation: 18: CREATE SCHEMA
May 14, 2026 - The SQL standard allows a DEFAULT CHARACTER SET clause in CREATE SCHEMA, as well as more subcommand types than are presently accepted by PostgreSQL.
Find elsewhere
🌐
Medium
medium.com › @prabhathsumindapathirana › getting-started-with-postgres-setting-up-a-user-schema-and-grants-bbb2a3f536df
Getting started with Postgres — Setting up a user, schema, and grants | by Prabhath Panangala Pathirage | Medium
August 17, 2021 - When you execute a query without a specific schema name Postgres will try to search for that object in a given path. As an example, if you need to query the table you initially created you need to run the following query. ... But as you can see, always specifying the schema name is repetitive and inconvenient. To avoid that you can add the xyz schema to the user’s search path. alter user foo set search_path=xyz, “$user”, public;
🌐
Baeldung
baeldung.com › home › persistence › connecting to a specific schema in jdbc
Connecting to a Specific Schema in JDBC | Baeldung
July 24, 2025 - Default PostgreSQL configuration will return $user and public schemas. The public schema we already mentioned, the $user schema, is a schema named after the current user, and it might not exist. In that case, the database ignores that schema. To add store schema to the search path, we can execute the query: ... After this, we can query the product table without specifying the schema. Also, we could remove the public schema from the search path. Setting the search path as we described above is a configuration on the ROLE level.
🌐
PostgreSQL
postgresql.org › docs › 9.3 › ddl-schemas.html
PostgreSQL: Documentation: 9.3: Schemas
January 28, 2021 - The ability to create like-named objects in different schemas complicates writing a query that references precisely the same objects every time. It also opens up the potential for users to change the behavior of other users' queries, maliciously or accidentally. Due to the prevalence of unqualified names in queries and their use in PostgreSQL internals, adding a schema to search_path effectively trusts all users having CREATE privilege on that schema.
🌐
PostGIS
postgis.net › workshops › postgis-intro › schemas.html
37. PostgreSQL Schemas — Introduction to PostGIS
If you log in as that user, you’ll find the default search_path for PostgreSQL is actually this: ... The first schema on the search path is the user’s named schema! So now the following conditions exist: The user exists, with the ability to create spatial tables. The user’s named schema exists, and the user owns it. The user’s search path has the user schema first, so new tables are automatically created there, and queries automatically search there first.
🌐
DB Vis
dbvis.com › thetable › create-schema-postgresql-statement-what-why-when-to-use
CREATE SCHEMA PostgreSQL Statement: What, Why & When to Use
October 30, 2024 - In PostgreSQL, we can create a schema by running the CREATE SCHEMA Postgres statement like so (replace schema_name_here with the actual name of your schema): ... If the CREATE SCHEMA PostgreSQL query will execute successfully, you will now have ...
🌐
Medium
medium.com › @jramcloud1 › understanding-the-public-schema-and-search-path-in-postgresql-a-practical-guide-b8b550fab9cc
Understanding the Public Schema and Search Path in PostgreSQL: A Practical Guide | by Jeyaram Ayyalusamy | Medium
June 10, 2025 - These are essential tasks for database developers and administrators working with PostgreSQL. To get a complete list of tables that exist in the public schema, use the information_schema.tables view: SELECT table_name FROM information_schema.tables WHERE table_schema = 'public' AND table_type = 'BASE TABLE'; 📌 What this does: This query filters the system’s metadata to return only base tables (i.e., not views or temporary tables) that are part of the public schema.
🌐
Beekeeper Studio
beekeeperstudio.io › blog › postgres-schemas
PostgreSQL How To Use Schemas | Beekeeper Studio
December 3, 2022 - To use schemas in PostgreSQL, you first need to create a schema. You can do this using the CREATE SCHEMA command. Here is an example: ... This will create a new schema called my_schema.
🌐
Reddit
reddit.com › r/postgresql › setting default schema in pgadmin4?
r/PostgreSQL on Reddit: Setting default schema in pgAdmin4?
June 4, 2021 -

I have tried to create table in pgAdmin4 in a certain designated schema.

However I always come across the following error

ERROR:  no schema has been selected to create in
LINE 4: CREATE TABLE concept (
                     ^

which is very annoying.

Can I set a default schema where I do not have to alter all the SQL commands?

I am copy-pasta-ing a bunch of SQL to set up a database, I just do no want to change stuff so often.

I tried

set search_path='eat_my_default_schema';

it just does not work well

Thanks!

🌐
Neon
neon.com › postgresql › postgresql-administration › postgresql-schema
An Essential Guide to PostgreSQL Schema
The first schema in the search path is called the current schema. Note that when you create a new object without explicitly specifying a schema name, PostgreSQL will also use the current schema for the new object.