From: andreas.imboden@bl.ch
To: pgsql-bugs@postgresql.org
Subject: BUG #14394: No error raised in IN-clause when commas are missing
Date: Mon, 24 Oct 2016 14:28:41 +0000
Message-ID: <20161024142841.1423.19672@wrigleys.postgresql.org> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>
The following bug has been logged on the website:
Bug reference: 14394
Logged by: Andreas Imboden
Email address: andreas.imboden@bl.ch
PostgreSQL version: 9.6.0
Operating system: Red Hat Entreprise Linux
Description:
/*
pg-version:
"PostgreSQL 9.6.0 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.8.5 201506
(...)""
bug description:
in list with new line instead of comma produces incorrect result.
should instead report a syntax error message
*/
set search_path = public;
select version();
drop table if exists abug;
create table abug (cname text, cvalue integer);
insert into abug values ('one', 1);
insert into abug values ('two', 1);
insert into abug values ('three', 1);
insert into abug values ('four', 1);
insert into abug values ('five', 1);
-- correct
select sum(cvalue) from abug
where cname in ('one', 'two', 'three', 'four', 'five');
-- correct, no comma after 'two', error is raised
select sum(cvalue) from abug
where cname in ('one', 'two' 'three', 'four', 'five');
-- correct
select sum(cvalue) from abug
where cname in (
'one',
'two',
'three',
'four',
'five');
-- not correct, result = 3
-- no comma after 'two', no error message, incorrect result
select sum(cvalue) from abug
where cname in (
'one',
'two'
'three',
'four',
'five');
--
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: andreas.imboden@bl.ch
Subject: Re: BUG #14394: No error raised in IN-clause when commas are missing
In-Reply-To: <20161024142841.1423.19672@wrigleys.postgresql.org>
References: <20161024142841.1423.19672@wrigleys.postgresql.org>
* 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