From: Tom Lane <tgl@sss.pgh.pa.us>
To: Alvaro Herrera <alvherre@2ndquadrant.com>
Cc: Jan Skydánek <jan.skydanek@betsys.com>
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: bug: evil autoConcat when each string is on new line
Date: Wed, 24 Apr 2019 10:26:57 -0400
Message-ID: <11395.1556116017@sss.pgh.pa.us> (raw)
In-Reply-To: <20190424124459.GA26812@alvherre.pgsql>
References: <20190424124459.GA26812@alvherre.pgsql>
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
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, alvherre@2ndquadrant.com, jan.skydanek@betsys.com
Subject: Re: bug: evil autoConcat when each string is on new line
In-Reply-To: <11395.1556116017@sss.pgh.pa.us>
References: <20190424124459.GA26812@alvherre.pgsql> <11395.1556116017@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