BUG #14394: No error raised in IN-clause when commas are missing

From: andreas(dot)imboden(at)bl(dot)ch
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #14394: No error raised in IN-clause when commas are missing
Date: 2016-10-24 14:28:41
Message-ID: 20161024142841.1423.19672@wrigleys.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 14394
Logged by: Andreas Imboden
Email address: andreas(dot)imboden(at)bl(dot)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');

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message hubert depesz lubaczewski 2016-10-24 14:44:21 Re: BUG #14394: No error raised in IN-clause when commas are missing
Previous Message ufaowl 2016-10-24 13:04:48 BUG #14393: Querry plan creation time is too long