Re: bug: evil autoConcat when each string is on new line - Mailing list pgsql-bugs

From Tom Lane
Subject Re: bug: evil autoConcat when each string is on new line
Date
Msg-id 11395.1556116017@sss.pgh.pa.us
Whole thread Raw
In response to Re: bug: evil autoConcat when each string is on new line  (Alvaro Herrera <alvherre@2ndquadrant.com>)
List pgsql-bugs
Alvaro Herrera <alvherre@2ndquadrant.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



pgsql-bugs by date:

Previous
From: Sergei Kornilov
Date:
Subject: Re: BUG #15777: Unexpected error in select from view with set-returning function and union
Next
From: Mike Lissner
Date:
Subject: CREATE SUBSCRIPTION fails with long passwords