Re: Disparity in search_path SHOW and SET

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Greg Sabino Mullane <greg(at)turnstep(dot)com>, PostgreSQL-patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: Disparity in search_path SHOW and SET
Date: 2005-12-23 00:12:06
Message-ID: 200512230012.jBN0C6m04919@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

Tom Lane wrote:
> Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> writes:
> > Agreed. I have gotten confused on how to set $user in the past. I have
> > developed the following patch that sets the default with the double
> > quotes around it, and it works fine. The patch also contains updated
> > documentation.
>
> This is really entirely irrelevant to Greg's complaint. To respond to
> that, you'd have to modify the behavior of SHOW.

Uh, SHOW does show the quotes:

test=> show search_path;
search_path
----------------
"$user",public
(1 row)

and that can be fed right into SET:

test=> set search_path = "$user",public;
SET

I thought that was the goal.

> Actually, it seems that this exposes a bug in the search_path code: if
> I wrote what you wrote, I'd really expect that it refers to a schema
> named exactly $user --- the quoting ought to suppress the substitution,
> one would think. Not sure how hard or easy that might be to implement
> though ...

I am unsure if the quotes are suppose to still allow dollar expansion.
It does in shell scripts. Actually this is kind of unusual:

test=> set search_path = '$user', public;
SET
test=> show search_path;
search_path
-----------------
"$user", public
(1 row)

It converts the single quotes to double.

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2005-12-23 00:14:49 Re: Trouble building 8.1.1 on Tru64 UNIX 5.1
Previous Message Qingqing Zhou 2005-12-23 00:05:10 Re: [Bizgres-general] WAL bypass for INSERT, UPDATE and

Browse pgsql-patches by date

  From Date Subject
Next Message Bruce Momjian 2005-12-23 00:14:49 Re: Trouble building 8.1.1 on Tru64 UNIX 5.1
Previous Message Tom Lane 2005-12-23 00:03:57 Re: Disparity in search_path SHOW and SET