From: Tom Lane <tgl@sss.pgh.pa.us>
To: Josh Kupershmidt <schmiddy@gmail.com>
Cc: M <sitrash@email.com>
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #6301: extra space in psql variable expansion
Date: Sat, 19 Nov 2011 11:20:39 -0500
Message-ID: <17805.1321719639@sss.pgh.pa.us> (raw)
In-Reply-To: <CAK3UJRHTU3nsDb66sBf9ZXKr1LGn7ru4RGoaDxE367Mw548W=A@mail.gmail.com>
References: <201111181812.pAIICbGk056384@wwwmaster.postgresql.org>
<CAK3UJRHTU3nsDb66sBf9ZXKr1LGn7ru4RGoaDxE367Mw548W=A@mail.gmail.com>
Josh Kupershmidt <schmiddy@gmail.com> writes:
> 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.
It doesn't actually do that, but rather splits the argument into two
arguments. \echo makes it look like there's spaces between arguments...
> 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.
I think the description of that commit addresses the point exactly:
... we considered an argument
completed as soon as we'd processed one backtick, variable
reference, or quoted substring. A string like 'FOO'BAR was thus
taken as two arguments not one, not exactly what one would
expect. In the new coding, an argument is considered terminated
only by unquoted whitespace or backslash.
regards, tom lane
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: tgl@sss.pgh.pa.us, schmiddy@gmail.com, sitrash@email.com
Subject: Re: BUG #6301: extra space in psql variable expansion
In-Reply-To: <17805.1321719639@sss.pgh.pa.us>
References: <201111181812.pAIICbGk056384@wwwmaster.postgresql.org> <CAK3UJRHTU3nsDb66sBf9ZXKr1LGn7ru4RGoaDxE367Mw548W=A@mail.gmail.com> <17805.1321719639@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox