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

From Noah Yetter
Subject Re: BUG #8094: psql prompt variable and command substitution broken
Date
Msg-id CAPuoA+kG6Y3N9VGXA4+NgEQWEmBmWSzhNGjo3Xy3qPs3uTgk3A@mail.gmail.com
Whole thread Raw
In response to Re: BUG #8094: psql prompt variable and command substitution broken  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
Thanks, quoting does indeed fix it.  It's worth noting that comparing the
9.1 and 9.2 documentation, there is no hint that quoting/substitution
behavior changed.  Or put another way, the docs say very little about
quoting/substitution behavior in general, aside from one highly confusing
"Note:" block.  I do see the quoting change in the 9.2 release notes now
that I look.


On Thu, Apr 18, 2013 at 12:48 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:

> 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: Tom Lane
Date:
Subject: Re: BUG #8025: PostgreSQL crash (>= 9.1 64 bit)
Next
From: Xavier Mouton-Dubosc
Date:
Subject: Re: BUG #8092: pg_dump need sur quoting schema name