Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Seems that there is parser problem when using IN with a double "(())" #2007

Closed
winoros opened this issue Nov 15, 2016 · 0 comments · Fixed by #2093
Closed

Seems that there is parser problem when using IN with a double "(())" #2007

winoros opened this issue Nov 15, 2016 · 0 comments · Fixed by #2093
Assignees
Labels
type/bug The issue is confirmed as a bug.
Milestone

Comments

@winoros
Copy link
Member

winoros commented Nov 15, 2016

Please answer these questions before submitting your issue. Thanks!

  1. What version of Go are you using (go version)?
    1.7.3

  2. What operating system and processor architecture are you using (go env)?
    GOARCH="amd64"
    GOBIN="/usr/local/go/bin"
    GOEXE=""
    GOHOSTARCH="amd64"
    GOHOSTOS="linux"
    GOOS="linux"
    GOPATH="/root/gopkg"
    GORACE=""
    GOROOT="/usr/local/go"
    GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
    CC="gcc"
    GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build945606389=/tmp/go-build -gno-record-gcc-switches"
    CXX="g++"
    CGO_ENABLED="1"

  3. What did you do?
    If possible, provide a recipe for reproducing the error.
    A complete runnable program is good.

DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t2;
DROP TABLE IF EXISTS t1xt2;

CREATE TABLE t1 (
  id_1 int(5) NOT NULL,
  t varchar(4) DEFAULT NULL
);

CREATE TABLE t2 (
  id_2 int(5) NOT NULL,
  t varchar(4) DEFAULT NULL
);

CREATE TABLE t1xt2 (
  id_1 int(5) NOT NULL,
  id_2 int(5) NOT NULL
);

INSERT INTO t1 VALUES (1, 'a'), (2, 'b'), (3, 'c'), (4, 'd');
INSERT INTO t2 VALUES (2, 'bb'), (3, 'cc'), (4, 'dd'), (12, 'aa');
INSERT INTO t1xt2 VALUES (2, 2), (3, 3), (4, 4);

SELECT DISTINCT t1.id_1 FROM t1 WHERE
(12 NOT IN (SELECT t1xt2.id_2 FROM t1xt2 WHERE t1.id_1 = t1xt2.id_1));

SELECT DISTINCT t1.id_1 FROM t1 WHERE
(12 NOT IN ((SELECT t1xt2.id_2 FROM t1xt2 where t1.id_1 = t1xt2.id_1)));

  1. What did you expect to see?

the result of two queries should be both

+------+
| id_1 |
+------+
| 1    |
| 2    |
| 3    |
| 4    |
+------+

  1. What did you see instead?
    the first is the expected result;
    the second is:
+------+
| id_1 |
+------+
| 2    |
| 3    |
| 4    |
+------+
@winoros winoros added the type/bug The issue is confirmed as a bug. label Nov 15, 2016
@hanfei1991 hanfei1991 added this to the rc1 milestone Nov 15, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/bug The issue is confirmed as a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants