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

From: Erik Rijkers <er(at)xs4all(dot)nl>
To: andreas(dot)imboden(at)bl(dot)ch
Cc: pgsql-bugs(at)postgresql(dot)org, pgsql-bugs-owner(at)postgresql(dot)org
Subject: Re: BUG #14394: No error raised in IN-clause when commas are missing
Date: 2016-10-24 14:48:49
Message-ID: 757c799204a29dbd3dafc33e0bbffe5a@xs4all.nl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On 2016-10-24 16:28, andreas(dot)imboden(at)bl(dot)ch wrote:
> The following bug has been logged on the website:
>
> Bug reference: 14394

> -- 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');
>

This is actually the correct result because

'two'
'three'

will be concatenated to 'twothree', which is isn't present
(leaving 'one', 'four', and 'five' as the 3 that SUM counted).

See also:

select
'two'
'three' ;

?column?
----------
twothree
(1 row)

which is, I believe, as described in the SQL standard.

Erik Rijkers

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Pantelis Theodosiou 2016-10-24 16:41:47 Re: BUG #14394: No error raised in IN-clause when commas are missing
Previous Message David G. Johnston 2016-10-24 14:47:37 Re: BUG #14394: No error raised in IN-clause when commas are missing