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