Home > Database > Mysql Tutorial > How to Permanently Change the PostgreSQL Schema Search Path?

How to Permanently Change the PostgreSQL Schema Search Path?

Mary-Kate Olsen
Release: 2025-01-01 11:06:12
Original
921 people have browsed it

How to Permanently Change the PostgreSQL Schema Search Path?

How to Permanently Modify Postgresql Schema Path

The Postgresql schema search path determines the order in which schemas are searched for tables specified without a schema name. By default, this path is set to only include the current schema.

To permanently set the schema path, you can use the SET SEARCH_PATH command. However, as you have observed, this setting is temporary and resets when you close the query window.

For a permanent solution, you can modify the search path for your user role using the ALTER ROLE command:

ALTER ROLE <your_login_role> SET search_path TO a,b,c;
Copy after login

Important Notes:

  1. If a schema name contains special characters, it must be enclosed in double quotes.
  2. The order of schemas in the search path determines the lookup priority. Tables with the same name in different schemas will be resolved based on the order specified.

The above is the detailed content of How to Permanently Change the PostgreSQL Schema Search Path?. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template