From: Tom Lane <tgl@sss.pgh.pa.us>
To: andreas.imboden@bl.ch
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #14394: No error raised in IN-clause when commas are missing
Date: Mon, 24 Oct 2016 10:46:31 -0400
Message-ID: <15138.1477320391@sss.pgh.pa.us> (raw)
In-Reply-To: <20161024142841.1423.19672@wrigleys.postgresql.org>
References: <20161024142841.1423.19672@wrigleys.postgresql.org>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>
andreas.imboden@bl.ch writes:
> -- no comma after 'two', no error message, incorrect result
> select sum(cvalue) from abug
> where cname in (
> 'one',
> 'two'
> 'three',
> 'four',
> 'five');
This is not a bug, it's required by the SQL standard's syntax for
string literals. Per the manual:
Two string constants that are only separated by whitespace *with
at least one newline* are concatenated and effectively treated as
if the string had been written as one constant.
https://www.postgresql.org/docs/9.6/static/sql-syntax-lexical.html#SQL-SYNTAX-CONSTANTS
regards, tom lane
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
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, andreas.imboden@bl.ch
Subject: Re: BUG #14394: No error raised in IN-clause when commas are missing
In-Reply-To: <15138.1477320391@sss.pgh.pa.us>
References: <20161024142841.1423.19672@wrigleys.postgresql.org> <15138.1477320391@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