Re: BUG #6301: extra space in psql variable expansion

From: Josh Kupershmidt <schmiddy(at)gmail(dot)com>
To: M <sitrash(at)email(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #6301: extra space in psql variable expansion
Date: 2011-11-18 20:48:18
Message-ID: CAK3UJRHTU3nsDb66sBf9ZXKr1LGn7ru4RGoaDxE367Mw548W=A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Fri, Nov 18, 2011 at 1:12 PM, M <sitrash(at)email(dot)com> wrote:
>
> When psql expands a :variable into a string it appends a space to the
> expansion string. For example:
>
> psql (8.4.9)
> Type "help" for help.
>
> testdb=> \set my_home /home/crazy
> testdb=> \echo :my_home/my-script.sql
> /home/crazy /my-script.sql
>
> Note the space between /home/crazy and /my-script.sql in the line above,
> while there's no space after /home/crazy two lines above where my_home
> variable is initialized.

It looks like this is a psql bug which has been fixed recently. I see
the OP's reported behavior on a 9.1.1 client, but in 9.2dev it works
as expected:

test=# \set my_home /home/crazy
test=# \echo :my_home/my-script.sql
/home/crazy/my-script.sql

I don't see the exact commit which fixed this, but I do see some fixes
to psql's lexer done recently, such as
928311a463d480ca566e2905a369ac6aa0c3e210, so maybe this case got fixed
as a nice side-effect.

Josh

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tomas Vondra 2011-11-18 20:52:33 Re: BUG #6300: duplicate key value violates unique constraint
Previous Message Tigran Mkrtchyan 2011-11-18 19:38:34 Re: BUG #6300: duplicate key value violates unique constraint