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

From: Noah Yetter <nyetter(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #8094: psql prompt variable and command substitution broken
Date: 2013-04-18 19:14:59
Message-ID: CAPuoA+kG6Y3N9VGXA4+NgEQWEmBmWSzhNGjo3Xy3qPs3uTgk3A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)sss(dot)pgh(dot)pa(dot)us> wrote:

> 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

Browse pgsql-bugs by date

  From Date Subject
Next Message vaiayand 2013-04-19 00:54:07 BUG #8095: postgres acquiring lock on a table when not in transaction
Previous Message Tom Lane 2013-04-18 18:54:00 Re: BUG #8025: PostgreSQL crash (>= 9.1 64 bit)