Re: Quoting $user as Parameter to SET - Mailing list pgsql-general

From Tom Lane
Subject Re: Quoting $user as Parameter to SET
Date
Msg-id 12751.1121123080@sss.pgh.pa.us
Whole thread Raw
In response to Quoting $user as Parameter to SET  ("Thomas F. O'Connell" <tfo@sitening.com>)
Responses Re: Quoting $user as Parameter to SET
List pgsql-general
"Thomas F. O'Connell" <tfo@sitening.com> writes:
> This is an important distinction because testing reveals that the
> quoted $user after the reversal is no longer actually a dynamic
> variable that results in a search_path that resolves to the current
> user.

Really?  It works fine for me:

regression=# create schema postgres;
CREATE SCHEMA
regression=# show search_path;
 search_path
--------------
 $user,public
(1 row)

regression=# select current_schemas(true);
       current_schemas
------------------------------
 {pg_catalog,postgres,public}
(1 row)

regression=# alter database regression set search_path = public, '$user';
ALTER DATABASE
regression=# \c -
You are now connected to database "regression".
regression=# show search_path;
   search_path
-----------------
 public, "$user"
(1 row)

regression=# select current_schemas(true);
       current_schemas
------------------------------
 {pg_catalog,public,postgres}
(1 row)

regression=#

            regards, tom lane

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: table locking and SELECT FOR UPDATE
Next
From: "Thomas F. O'Connell"
Date:
Subject: Re: Quoting $user as Parameter to SET