pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Ron <ronljohnsonjr@gmail.com>
To: pgsql-general@lists.postgresql.org
Subject: Re: Is this a bug ?
Date: Wed, 23 Oct 2019 10:47:42 -0500
Message-ID: <0e1c9266-80fa-c879-ef10-c585e93e0ae5@gmail.com> (raw)
In-Reply-To: <6048315C-CE0E-482F-9F48-B300E4D7AC52@aol.com>
References: <6048315C-CE0E-482F-9F48-B300E4D7AC52@aol.com>

On 10/23/19 10:42 AM, Ravi Krishna wrote:
> We noticed this bug in Redshift. It then occurred to me that this may
> very well be a PG bug since Redshift is based on PG.
>
> Reproduced it in Version 11.5
>
> create table bugtest (fld1 char(1)) ;
>
> insert into bugtest values('a');
> insert into bugtest values('b');
> insert into bugtest values('c');
> insert into bugtest values('d');
> insert into bugtest values('e');
>
> select count(*) from bugtest where fld1 in ('a','b','c',
>                                              'd','e');  -> produces 5 as output.
> So far so good.
>
> Now check this:
>
> select count(*) from bugtest where fld1 in ('a','b','c'
>                                              'd','e');
>    
> Note the missing comma after 'c'.
>
> PG takes it a syntactically right SQL and gives 3 as output.
>
> In SQLServer it errors out SQL Error [102] [S0001]: Incorrect syntax near 'd'.
>
> Can't believe this bug was never found before.  We ended up wasting lot of time to figure this out.

Confirmed in 9.6.

postgres@haggis:~$ psql
psql (9.6.15)
Type "help" for help.

postgres=# create table bugtest (fld1 char(1)) ;
CREATE TABLE
postgres=#
postgres=# insert into bugtest values('a');
INSERT 0 1
postgres=# insert into bugtest values('b');
INSERT 0 1
postgres=# insert into bugtest values('c');
INSERT 0 1
postgres=# insert into bugtest values('d');
INSERT 0 1
postgres=# insert into bugtest values('e');
INSERT 0 1
postgres=# select count(*) from bugtest where fld1 in ('a','b','c',
postgres(# 'd','e');
  count
-------
      5
(1 row)

postgres=# select count(*) from bugtest where fld1 in ('a','b','c'
postgres(# 'd','e');
  count
-------
      3
(1 row)



-- 
Angular momentum makes the world go 'round.





view thread (35+ messages)  latest in thread

Message-ID: <0e1c9266-80fa-c879-ef10-c585e93e0ae5@gmail.com>
Permalink:  ../0e1c9266-80fa-c879-ef10-c585e93e0ae5@gmail.com/
Also on:    postgresql.org/message-id/0e1c9266-80fa-c879-ef10-c585e93e0ae5@gmail.com

 · 

reply

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-general@postgresql.org
  Cc: ronljohnsonjr@gmail.com
  Subject: Re: Is this a bug ?
  In-Reply-To: <0e1c9266-80fa-c879-ef10-c585e93e0ae5@gmail.com>
  References: <6048315C-CE0E-482F-9F48-B300E4D7AC52@aol.com> <0e1c9266-80fa-c879-ef10-c585e93e0ae5@gmail.com>

* 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