Schema search_path and $user

Started by Postgres Useralmost 17 years ago3 messagesgeneral
Jump to latest
#1Postgres User
postgres.developer@gmail.com

In the docs, I see repeated references to $user in the postgresql.conf
schema search_path setting such as:

search_path = '"$user",public'

But I don't see any info on the meaning of '$user' here. Is $user
some kind of variable within postgresql.conf that refers to the
current user? Can it be replaced with a real group name to control
schema search_paths for specific groups/users?

Thanks.

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Postgres User (#1)
Re: Schema search_path and $user

Postgres User <postgres.developer@gmail.com> writes:

In the docs, I see repeated references to $user in the postgresql.conf
schema search_path setting such as:

search_path = '"$user",public'

But I don't see any info on the meaning of '$user' here.

I guess you didn't read the actual documentation of search_path:
http://www.postgresql.org/docs/8.3/static/runtime-config-client.html#GUC-SEARCH-PATH
It says

The value for search_path has to be a comma-separated list of schema
names. If one of the list items is the special value $user, then the
schema having the name returned by SESSION_USER is substituted, if there
is such a schema. (If not, $user is ignored.)

regards, tom lane

#3Postgres User
postgres.developer@gmail.com
In reply to: Tom Lane (#2)
Re: Schema search_path and $user

Thanks for the link, I wasn't reading the right page(s) in the documentation.

Show quoted text

On Mon, Jul 6, 2009 at 12:19 PM, Tom Lane<tgl@sss.pgh.pa.us> wrote:

Postgres User <postgres.developer@gmail.com> writes:

In the docs, I see repeated references to $user in the postgresql.conf
schema search_path setting such as:

search_path = '"$user",public'

But I don't see any info on the meaning of '$user' here.

I guess you didn't read the actual documentation of search_path:
http://www.postgresql.org/docs/8.3/static/runtime-config-client.html#GUC-SEARCH-PATH
It says

The value for search_path has to be a comma-separated list of schema
names. If one of the list items is the special value $user, then the
schema having the name returned by SESSION_USER is substituted, if there
is such a schema. (If not, $user is ignored.)

                       regards, tom lane