Re: Modifying search_path in a stored procedure

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Eric Brown <eric(dot)brown(at)propel(dot)com>
Cc: Pgsql-General (E-mail) <pgsql-general(at)postgresql(dot)org>
Subject: Re: Modifying search_path in a stored procedure
Date: 2005-01-11 22:46:43
Message-ID: 4822.1105483603@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Eric Brown <eric(dot)brown(at)propel(dot)com> writes:
> I know I can SET the schema search_path in a stored procedure, but is
> there any way to retrieve it first so that I can get the current value
> and manipulate that rather than just replace it?

current_setting() would produce the value you want to give back to SET
(or more likely set_config()). There's also current_schema() and
current_schemas() if you want a more digested form. See "System
Information Functions" and "System Administration Functions" in TFM.

It might also be that SET LOCAL would solve your problem with less fuss.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Eric Brown 2005-01-11 23:06:54 Running a void function in psql
Previous Message Michael Fuhr 2005-01-11 21:55:54 Re: Modifying search_path in a stored procedure