Re: bug: evil autoConcat when each string is on new line

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
Cc: Jan Skydánek <jan(dot)skydanek(at)betsys(dot)com>, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: bug: evil autoConcat when each string is on new line
Date: 2019-04-24 14:26:57
Message-ID: 11395.1556116017@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Alvaro Herrera <alvherre(at)2ndquadrant(dot)com> writes:
> 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.

Yeah. Quoting from SQL99:

<separator> ::= { <comment> | <white space> }...

<character string literal> ::=
[ <introducer><character set specification> ]
<quote> [ <character representation>... ] <quote>
[ { <separator> <quote> [ <character representation>... ] <quote> }... ]

Syntax Rules

1) In a <character string literal> or <national character string
literal>, the sequence:

<quote> <character representation>... <quote>
<separator> <quote> <character representation>... <quote>

is equivalent to the sequence

<quote> <character representation>... <character
representation>... <quote>

NOTE 47 - The <character representation>s in the equivalent
sequence are in the same sequence and relative sequence as in
the original <character string literal>.

5) In a <character string literal>, <national character string
literal>, <bit string literal>, <binary string literal>, or <hex
string literal>, a <separator> shall contain a <newline>.

Don't ask us, we just implement it.

regards, tom lane

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Mike Lissner 2019-04-24 17:07:45 CREATE SUBSCRIPTION fails with long passwords
Previous Message Sergei Kornilov 2019-04-24 13:46:19 Re: BUG #15777: Unexpected error in select from view with set-returning function and union