BUG #15128: Erroneous inner query is executing with wrong results

Поиск
Список
Период
Сортировка
От PG Bug reporting form
Тема BUG #15128: Erroneous inner query is executing with wrong results
Дата
Msg-id 152172870101.9509.2495966056168831824@wrigleys.postgresql.org
обсуждение исходный текст
Ответы Re: BUG #15128: Erroneous inner query is executing with wrong results
Список pgsql-bugs
The following bug has been logged on the website:

Bug reference:      15128
Logged by:          Yossi Eilaty
Email address:      yossi.eilaty@gong.io
PostgreSQL version: 9.6.2
Operating system:   x86_64-pc-linux-gnu, compiled by gcc (Debian 4.9.2
Description:

Consider the following tables:
CREATE TABLE a (
  r BIGINT,
  y BIGINT
);
CREATE TABLE b (
  x BIGINT,
  y BIGINT
);

with the following data:

INSERT INTO a (r, y) VALUES (1, 1);
INSERT INTO a (r, y) VALUES (2, 2);

INSERT INTO b (x, y) VALUES (1, 1);
INSERT INTO b (x, y) VALUES (2, 2);

If I run the following query:

SELECT y
FROM b
WHERE x IN (SELECT x
            FROM (SELECT r
                  FROM a
                  WHERE y = 1) the_x);

I get, as a result, the y value of all rows of table b, which is wrong since
the inner query 

SELECT x
            FROM (SELECT r
                  FROM a
                  WHERE y = 1) the_x

is wrong and if run solely returns the error "[42703] ERROR: column "x" does
not exist", which is correct.

The same thing happens for the following query:

SELECT y
FROM b
WHERE x IN (SELECT x
            FROM (SELECT x
                  FROM a
                  WHERE y = 1) the_x);

where, again, the innermost query is wrong (there's no x in a).



В списке pgsql-bugs по дате отправления:

Предыдущее
От: PG Bug reporting form
Дата:
Сообщение: BUG #15127: epoch lies 1 hour ahead
Следующее
От: Tom Lane
Дата:
Сообщение: Re: BUG #15127: epoch lies 1 hour ahead