In PostgreSQL the system determines which table is meant by following a search path, which is a list of schemas to look in.

The first matching table in the search path is taken to be the one wanted, otherwise, if there is no match a error is raised, even if matching table names exist in other schemas in the database.

To show the current search path you can use the following command:

SHOW search_path;

And to put the new schema in the path, you could use:

SET search_path TO myschema;

Or if you want multiple schemas:

SET search_path TO myschema, public;

Reference: https://www.postgresql.org/docs/current/static/ddl-schemas.html

Answer from Ciro Pedrini on Stack Overflow
🌐
PostgreSQL
postgresql.org › docs › current › ddl-schemas.html
PostgreSQL: Documentation: 18: 5.10. Schemas
May 14, 2026 - OPERATOR(schema.operator) This is needed to avoid syntactic ambiguity. An example is: SELECT 3 OPERATOR(pg_catalog.+) 4; In practice one usually relies on the search path for operators, so as not to have to write anything so ugly as that. By default, users cannot access any objects in schemas they do not own.
People also ask

How can I list all schemas in PostgreSQL and understand their properties?
PostgreSQL lets you list schemas via information_schema.schemata or pg_catalog.pg_namespace, showing names, privileges, and sizes. You can join system catalogs to view access controls or summarize schema disk usage, aiding auditing, optimization, and database management.
🌐
airbyte.com
airbyte.com › home › data engineering resources › postgresql list all schemas in database
How to List All Schemas in the PostgreSQL Database: An Ultimate ...
How can I make PostgreSQL schema changes without causing downtime?
You can avoid downtime in PostgreSQL by using pg_repack for online table rebuilding, performing concurrent index creation, and employing view- or shadow-table versioning. These methods let schema changes occur in the background without blocking reads or writes.
🌐
airbyte.com
airbyte.com › home › data engineering resources › postgresql list all schemas in database
How to List All Schemas in the PostgreSQL Database: An Ultimate ...
What is schema drift in PostgreSQL and why is it such a critical issue?
Schema drift in PostgreSQL is the unplanned or undocumented change in database structure—such as added, removed, or modified columns—causing inconsistencies between environments. It's critical because it can trigger outages, application failures, and complex debugging across dev, staging, and production
🌐
airbyte.com
airbyte.com › home › data engineering resources › postgresql list all schemas in database
How to List All Schemas in the PostgreSQL Database: An Ultimate ...
🌐
Devart
devart.com › dbforge › postgresql › studio › postgres-list-schemas.html
How to Show List of All Schemas in PostgreSQL Database - Easy Examples
SELECT proname FROM pg_proc p JOIN pg_namespace n ON p.pronamespace = n.oid WHERE n.nspname = 'sales'; Let's execute this query to retrieve all the procedures from the sales schema: PostgreSQL schemas serve as vital organizational structures within databases, providing a logical framework for categorizing and managing data.
🌐
Dataedo
dataedo.com › kb › query › postgresql › list-schemas-in-database
List schemas in PostgreSQL database - PostgreSQL Data Dictionary Queries
November 7, 2018 - Query below lists all schemas in PostgreSQL database. Schemas include default pg_* , information_schema and temporary schemas. If you want to list user only schemas use this script. select s.nspname as table_schema, s.oid as schema_id, u.usename as owner from pg_catalog.pg_namespace s join pg_catalog.pg_user u on u.usesysid = s.nspowner order by table_schema; table_schema - schema name ·
🌐
Airbyte
airbyte.com › home › data engineering resources › postgresql list all schemas in database
How to List All Schemas in the PostgreSQL Database: An Ultimate Guide | Airbyte
September 9, 2025 - The simplest way to list schemas in PostgreSQL is using psql's built-in meta-commands: \dn · This displays a basic list of schema names and their owners. For more detailed information including access privileges and descriptions: \dn+ These ...
Find elsewhere
🌐
SimpleBackups
simplebackups.com › home › blog › how to list schemas in postgresql and related commands
How to List Schemas in PostgreSQL and Related Commands
November 22, 2023 - SELECT nspname FROM pg_catalog.pg_namespace WHERE nspowner = (SELECT oid FROM pg_roles WHERE rolname = 'username'); This query, for example, lists schemas owned by a specific user. Below you will also find the most commonly used and valuable commands. How to view the details of a specific schema in PostgreSQL
🌐
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?

🌐
Softbuilder
soft-builder.com › home › how to list all schemas in postgresql?
How to list all schemas in PostgreSQL? - Softbuilder Blog
May 23, 2021 - We can list all PostgreSQL schemas using the (ANSI) standard INFORMATION_SCHEMA: SELECT schema_name FROM information_schema.schemata; Alternatively, we can use: SELECT nspname FROM pg_catalog.pg_namespace; Sample results As a result, you will ...
🌐
CommandPrompt Inc.
commandprompt.com › education › how-to-list-schemas-in-postgresql
How to List Schemas in PostgreSQL — CommandPrompt Inc.
February 1, 2023 - That’s all from this blog! ... In PostgreSQL, the standard “information_schema”, a system catalog table named “pg_namespace”, and the “\dn” command is used to get the list of available schemas.
Address   2950 Newmarket ST STE 101 - 231, 98226, Bellingham
🌐
RazorSQL
razorsql.com › articles › postgresql_system_queries.html
PostgreSQL System Queries for Getting Tables, Schemas, Databases, Views, Indexes, Functions, and Triggers
This query will return all databases for the server: select * from pg_catalog.pg_database · These queries will return all views across all schemas in the database: select * from information_schema.views select * from pg_catalog.pg_views;
🌐
DB Vis
dbvis.com › thetable › schemas-in-postgresql
Schemas in PostgreSQL: Best Practices of PostgreSQL Schemas
March 11, 2024 - 1 -- Create the "inventory" schema ... table 32 SELECT * FROM public.users; ... demonstrate how to query products from the "inventory.products" table and users from the "public.users" table. What has been achieved in the end? It is now simpler to maintain and organize your e-commerce database since we have successfully segregated the product inventory from the customer data. This example demonstrates the usefulness of PostgreSQL schemas and how they ...
🌐
w3resource
w3resource.com › PostgreSQL › snippets › postgresql-list-schemas.php
How to List Schemas in PostgreSQL: Commands & Examples
December 23, 2024 - The pg_namespace catalog contains information about all schemas in a PostgreSQL database, and you can query it to get a list of schemas. ... This command, when used in the psql command-line interface, displays all schemas within the current database along with their owners. It is a quick way to get a schema overview. Example 2: Listing Schemas with a Query on pg_namespace ... -- Retrieves the names of all schemas in the database SELECT nspname AS schema_name FROM pg_namespace;
🌐
CommandPrompt Inc.
commandprompt.com › education › how-to-get-the-name-of-the-current-schema-in-postgresql
How to Get the Name of the Current Schema in PostgreSQL — CommandPrompt Inc.
August 14, 2023 - SELECT CURRENT_SCHEMA, CURRENT_SCHEMA(); The output shows that the current schema name is “public”: How to Get the Name of the Current Schema in PostgreSQL Using CURRENT_SCHEMAS Function?
🌐
TablePlus
tableplus.com › blog › 2018 › 04 › postgresql-how-to-list-all-schemas.html
PostgreSQL - How to list all available schemas? | TablePlus
April 2, 2018 - Except the system schemas that you usually do not interact with, all the available schemas will be listed here, including the empty ones. To also see the system schemas, select the dropdown next to the + button > Settings > Show System Schemas. Need a good GUI tool for PostgreSQL?
🌐
Neon
neon.com › postgresql › postgresql-administration › postgresql-schema
An Essential Guide to PostgreSQL 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. The current_schema() function returns the current schema: SELECT current_schema(); Here is the output: current_schema ---------------- public (1 row) This is why PostgreSQL uses public for every new object that you create.
🌐
Squash
squash.io › executing-queries-in-postgresql-using-schemas
Executing Queries in PostgreSQL Using Schemas
October 30, 2023 - For example, if you have a table named "users" in a schema named "public", you can query it as follows: ... This syntax tells PostgreSQL to select all rows from the "users" table in the "public" schema.