From: | PG Bug reporting form <noreply(at)postgresql(dot)org> |
---|---|
To: | pgsql-bugs(at)lists(dot)postgresql(dot)org |
Cc: | luza(dot)mbox(at)gmail(dot)com |
Subject: | BUG #16212: subquery block allows to overwrite table alias defined earlier |
Date: | 2020-01-16 22:36:16 |
Message-ID: | 16212-cc31996adcf45996@postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
The following bug has been logged on the website:
Bug reference: 16212
Logged by: Denis Girko
Email address: luza(dot)mbox(at)gmail(dot)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).
From | Date | Subject | |
---|---|---|---|
Next Message | PG Bug reporting form | 2020-01-16 23:27:29 | BUG #16213: segfault when running a query |
Previous Message | Christophe Pettus | 2020-01-16 18:46:55 | Re: BUG #16205: background worker "logical replication worker" (PID 25218) was terminated by signal 11: Segmentation |