Re: BUG #8094: psql prompt variable and command substitution broken

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: nyetter(at)gmail(dot)com
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #8094: psql prompt variable and command substitution broken
Date: 2013-04-18 18:48:41
Message-ID: 8164.1366310921@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

nyetter(at)gmail(dot)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

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2013-04-18 18:54:00 Re: BUG #8025: PostgreSQL crash (>= 9.1 64 bit)
Previous Message nyetter 2013-04-18 17:43:33 BUG #8094: psql prompt variable and command substitution broken