Re: BUG #8094: psql prompt variable and command substitution broken - Mailing list pgsql-bugs

From Tom Lane
Subject Re: BUG #8094: psql prompt variable and command substitution broken
Date
Msg-id 8164.1366310921@sss.pgh.pa.us
Whole thread Raw
In response to BUG #8094: psql prompt variable and command substitution broken  (nyetter@gmail.com)
Responses Re: BUG #8094: psql prompt variable and command substitution broken  (Noah Yetter <nyetter@gmail.com>)
List pgsql-bugs
nyetter@gmail.com writes:
> My psql PROMPT1, set through /etc/sysconfig/pgsql/psqlrc, is the following:
> h:%M%040d:%/%040U:%n%040AC:%:AUTOCOMMIT:%040TX:%x%012%R%#%040

You did not show us exactly how you set that, but I speculate that you
weren't bothering to quote it.  9.2 is more consistent than prior
versions were about expanding :variable references in backslash
commands, which means that you'd better quote the reference to
:AUTOCOMMIT if you don't want it expanded on-the-spot before it goes
into the prompt string.  I'd suggest putting single quotes around the
argument of \set PROMPT1, viz

\set PROMPT1 'h:%M%040d:%/%040U:%n%040AC:%:AUTOCOMMIT:%040TX:%x%012%R%#%040'

            regards, tom lane

pgsql-bugs by date:

Previous
From: nyetter@gmail.com
Date:
Subject: BUG #8094: psql prompt variable and command substitution broken
Next
From: Tom Lane
Date:
Subject: Re: BUG #8025: PostgreSQL crash (>= 9.1 64 bit)