Re: Disparity in search_path SHOW and SET

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Greg Sabino Mullane <greg(at)turnstep(dot)com>
Cc: PostgreSQL-patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: Disparity in search_path SHOW and SET
Date: 2005-12-22 23:57:19
Message-ID: 200512222357.jBMNvJC22503@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

Greg Sabino Mullane wrote:
[ There is text before PGP section. ]
>
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
>
> > Well, sure, because you told it to. Why isn't the last parameter "false"?
>
> Thanks. I knew I was overlooking something. I've obviously been staring at
> the code too long. :) Still, would it make more sense for SHOW search_path
> to return this:
>
> "$user",public

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.

I just never realized that dollar signs have to be double-quoted, but I
it makes sense now that I see it:

test=> select lanname as $user from pg_language;
ERROR: syntax error at or near "$" at character 19
LINE 1: select lanname as $user from pg_language;
^
test=> select lanname as "$user" from pg_language;
$user
----------
internal
c
sql
(3 rows)

Are the quotes an improvement?

search_path
----------------
"$user",public
(1 row)

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

--
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

Attachment Content-Type Size
unknown_filename text/plain 3.9 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2005-12-23 00:03:57 Re: Disparity in search_path SHOW and SET
Previous Message Andrew Dunstan 2005-12-22 23:53:28 Re: PL/pgSQL proposal: using list of scalars in assign

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2005-12-23 00:03:57 Re: Disparity in search_path SHOW and SET
Previous Message Bruce Momjian 2005-12-22 23:09:49 Re: [PATCHES] [BUGS] Solaris cc compiler on amd: PostgreSQL does not