Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PostgreSQL: How do I set the search_path at the user level? [duplicate]

Tags:

postgresql

I want to set the default search_path to something other than the "public" schema. But I only want to do this for a particular user. How can I accomplish this?

like image 382
Jin Kim Avatar asked Jun 01 '10 17:06

Jin Kim


People also ask

What is set Search_path in Postgres?

Specifies the order in which Vertica searches schemas when a SQL statement specifies a table name that is unqualified by a schema name. SET SEARCH_PATH overrides the current session's search path, which is initially set from the user profile.

What is the default schema search path in PostgreSQL?

The default search path makes PostgreSQL search first in the schema named exactly as the user name you used for logging into the database. If the user name is different from the schema names, or there is no table szymon. a then it would look in the public. a table.

How do I change the default schema in PostgreSQL?

SET search_path TO inventory, public; Now inventory is a default schema and you don't need to mention it explicitly to access it. You can change the name or the ownership of a schema by using ALTER SCHEMA. DROP SCHEMA [IF EXISTS] schema_name [CASCADE | RESTRICT];

How do I connect to a specific schema in PostgreSQL?

How to Use Schema With PostgreSQL. To access an object of a database schema, we must specify the schema's name before the name of a given database object that we want to use. For example, to query table product within schema store, we need to use the qualified name of the table: SELECT * FROM store.


1 Answers

I found the answer:

ALTER ROLE username SET search_path = schema1,schema2,schema3,etc; 
like image 58
Jin Kim Avatar answered Sep 20 '22 03:09

Jin Kim