Re: BUG #10201: Invalid input accepted with IN expression

From: Daniel Baston <dbaston(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #10201: Invalid input accepted with IN expression
Date: 2014-05-02 20:08:39
Message-ID: CA+K_q_p8jRb=td0=NWhV_Hq+n+hPkEowDn_yQ4BV6c_b+xUR8Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Got it. Apologies for the false positive.

On Fri, May 2, 2014 at 4:07 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

> dbaston(at)gmail(dot)com writes:
> > If two items in an IN expression are separated by a newline instead of a
> > comma, those items will be ignored with no error.
>
> > CREATE TABLE testing (id varchar(1));
> > INSERT INTO testing VALUES ('1'), ('2'), ('3'), ('4'), ('5');
>
> > -- Missing comma produces a syntax error
> > SELECT * FROM testing WHERE id IN ('1' '2', '3');
>
> > -- Unless there is a newline
> > SELECT * FROM testing WHERE id IN ('1'
> > '2', '3');
>
> This is not a bug; what you've got there is the SQL-standard way of
> breaking a literal across lines. Compare
>
> select '1'
> '2', '3';
> ?column? | ?column?
> ----------+----------
> 12 | 3
> (1 row)
>
> regards, tom lane
>

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message vetri_2020 2014-05-03 11:04:01 BUG #10207: Simple select query returns duplicate row - Critical issue
Previous Message Tom Lane 2014-05-02 20:07:09 Re: BUG #10201: Invalid input accepted with IN expression