Re: How to show the current schema or search path in the psql PROMP

From: Adrian Klaver <adrian(dot)klaver(at)gmail(dot)com>
To: Scott Marlowe <scott(dot)marlowe(at)gmail(dot)com>
Cc: Joshua Tolley <eggyknap(at)gmail(dot)com>, Schwaighofer Clemens <clemens(dot)schwaighofer(at)tequila(dot)jp>, pgsql-general(at)postgresql(dot)org
Subject: Re: How to show the current schema or search path in the psql PROMP
Date: 2010-06-11 18:32:32
Message-ID: 4C128140.6040705@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 06/11/2010 11:10 AM, Scott Marlowe wrote:
> On Fri, Jun 11, 2010 at 11:29 AM, Adrian Klaver<adrian(dot)klaver(at)gmail(dot)com> wrote:
>> On 06/11/2010 10:23 AM, Joshua Tolley wrote:
>>>
>>> On Wed, Jun 09, 2010 at 05:52:49PM +0900, Schwaighofer Clemens wrote:
>>>>
>>>> Hi,
>>>>
>>>> I am trying to figure out how I can show the current search_path, or
>>>> better the first search_path entry (the active schema) in the PROMPT
>>>> variable for psql.
>>>>
>>>> Is there any way to do that? I couldn't find anything useful ...
>>>
>>> 5432 josh(at)josh# SHOW search_path;
>>> search_path
>>> ----------------
>>> "$user",public
>>> (1 row)
>>>
>>> --
>>> Joshua Tolley / eggyknap
>>> End Point Corporation
>>> http://www.endpoint.com
>>
>> From here:
>> http://www.postgresql.org/docs/8.4/interactive/functions-info.html
>> current_schema[()]
>>
>> Maybe combined with
>> %`command`
>>
>> The output of command, similar to ordinary "back-tick" substitution.
>>
>> http://www.postgresql.org/docs/8.4/interactive/app-psql.html
>
> But that runs a shell command, how's that supposed to get the
> search_path? I've been trying to think up a solution to that and
> can't come up with one.

I tried running a psql command using current_schema. It got the schema,
unfortunately on a different session than the one I was in. So no it
will not work.

--
Adrian Klaver
adrian(dot)klaver(at)gmail(dot)com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Martijn van Oosterhout 2010-06-11 19:48:54 Re: checkpoint spikes
Previous Message Scott Marlowe 2010-06-11 18:10:54 Re: How to show the current schema or search path in the psql PROMP