Re: BUG #6301: extra space in psql variable expansion - Mailing list pgsql-bugs

From Josh Kupershmidt
Subject Re: BUG #6301: extra space in psql variable expansion
Date
Msg-id CAK3UJRHTU3nsDb66sBf9ZXKr1LGn7ru4RGoaDxE367Mw548W=A@mail.gmail.com
Whole thread Raw
In response to BUG #6301: extra space in psql variable expansion  ("M" <sitrash@email.com>)
Responses Re: BUG #6301: extra space in psql variable expansion  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
On Fri, Nov 18, 2011 at 1:12 PM, M <sitrash@email.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

pgsql-bugs by date:

Previous
From: Tigran Mkrtchyan
Date:
Subject: Re: BUG #6300: duplicate key value violates unique constraint
Next
From: "Tomas Vondra"
Date:
Subject: Re: BUG #6300: duplicate key value violates unique constraint