Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
Thread:
Lists: pgsql-hackerspgsql-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

In response to

Responses

pgsql-hackers by date

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

pgsql-patches by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group