From: | raf(at)raf(dot)org |
---|---|
To: | pgsql-bugs(at)lists(dot)postgresql(dot)org |
Subject: | Re: bug: evil autoConcat when each string is on new line |
Date: | 2019-04-24 23:13:08 |
Message-ID: | 20190424231308.epmyxnyym2jjy24m@raf.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
Alvaro Herrera wrote:
> On 2019-Apr-24, Jan Skydánek wrote:
>
> > Works (definitely NOT expected):
> > SELECT
> > 'aaa'
> > 'bbb'
> > 'ccc'
> > ; -- result is: 'aaabbbccc'
> >
> > I really hope this behavior is not intentional.
>
> Actually it's the SQL standard that defines that it must work in exactly
> that way.
>
> --
> Álvaro Herrera https://www.2ndQuadrant.com/
> PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
Perhaps what Jan meant to do was:
select
'aaa',
'bbb',
'ccc'
;
Many languages automatically concatenate consecutive
string literals, not just SQL. Even C does it. Probably
because there's no other useful interpretation of what
multiple consecutive string literals means. It's either
concatenate them or treat it as a syntax error.
Concatenating can be useful so it wins.
Actually, I just tried that command on a single line
and that was a syntax error. So what do I know?
Presumably the SQL standard says to do that as well. :-)
It does seem like an inconsistency. I wouldn't have
expected SQL to be so whitespace-dependant but there'll
be a good reason for it somewhere. And, again, it's not
the only language where newlines matter. :-)
cheers,
raf
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2019-04-24 23:27:10 | Re: BUG #15672: PostgreSQL 11.1/11.2 crashed after dropping a partition table |
Previous Message | Tomas Vondra | 2019-04-24 21:17:50 | Re: CREATE SUBSCRIPTION fails with long passwords |