BUG #16212: subquery block allows to overwrite table alias defined earlier

Поиск
Список
Период
Сортировка
От PG Bug reporting form
Тема BUG #16212: subquery block allows to overwrite table alias defined earlier
Дата
Msg-id 16212-cc31996adcf45996@postgresql.org
обсуждение исходный текст
Ответы Re: BUG #16212: subquery block allows to overwrite table alias defined earlier  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: BUG #16212: subquery block allows to overwrite table aliasdefined earlier  ("David G. Johnston" <david.g.johnston@gmail.com>)
Список pgsql-bugs
The following bug has been logged on the website:

Bug reference:      16212
Logged by:          Denis Girko
Email address:      luza.mbox@gmail.com
PostgreSQL version: 9.6.16
Operating system:   Linux
Description:

Short example to illustrate the issue:

SELECT
   a,
   b.p,
   c.p
FROM
  (VALUES (1)) a
  JOIN LATERAL (
    SELECT p FROM (VALUES (2)) p
  ) b ON TRUE
  JOIN LATERAL (
    SELECT p FROM (VALUES (3)) p
  ) c ON TRUE
;

Expected result ((1), (2), (3))
Actual result ((1), (2), (2)).
("p" introduced in second JOIN overwrites the one defined by first)
Regular JOIN (not LATERAL) is not the subject of such an issue.


Another example:
SELECT
   a,
   b.a
FROM
  (VALUES (1)) a
  JOIN (
    SELECT a FROM (VALUES (2)) a
  ) b ON TRUE
;

Expected result ((1), (2))
Actual result ((2), (2)).
(JOIN overwrites the "a" defined before)
Both regular and lateral JOIN show the same behaviour.

Scalars also can cause the same result:

SELECT
   a,
   b.a
FROM
  (VALUES (1)) a
  JOIN (
    SELECT 2 AS a
  ) b ON TRUE
;

Expected result ((1), 2)
Actual result (2, 2).


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

Предыдущее
От: Christophe Pettus
Дата:
Сообщение: Re: BUG #16205: background worker "logical replication worker" (PID25218) was terminated by signal 11: Segmentation
Следующее
От: PG Bug reporting form
Дата:
Сообщение: BUG #16213: segfault when running a query