mirror of
https://github.com/postgres/postgres.git
synced 2025-11-25 12:03:53 +03:00
Fix possible usage of incorrect UPPERREL_SETOP RelOptInfo
03d40e4b5 allowed dummy UNION [ALL] children to be removed from the plan
by checking for is_dummy_rel(). That commit neglected to still account
for the relids from the dummy rel so that the correct UPPERREL_SETOP
RelOptInfo could be found and used for adding the Paths to.
Not doing this could result in processing of subsequent UNIONs using the
same RelOptInfo as a previously processed UNION, which could result in
add_path() freeing old Paths that are needed by the previous UNION.
The same fix was independently submitted (2 mins later) by Richard Guo.
Reported-by: Alexander Lakhin <exclusion@gmail.com>
Author: David Rowley <dgrowleyml@gmail.com>
Discussion: https://postgr.es/m/bee34aec-659c-46f1-9ab7-7bbae0b7616c@gmail.com
This commit is contained in:
@@ -1260,14 +1260,14 @@ SELECT four FROM tenk1 WHERE 1=2
|
||||
UNION
|
||||
SELECT ten FROM tenk1 WHERE 1=2
|
||||
ORDER BY 1;
|
||||
QUERY PLAN
|
||||
--------------------------------------
|
||||
QUERY PLAN
|
||||
-----------------------------------------------------------------------------------------
|
||||
Sort
|
||||
Output: unnamed_subquery.two
|
||||
Sort Key: unnamed_subquery.two
|
||||
-> Result
|
||||
Output: unnamed_subquery.two
|
||||
Replaces: Aggregate
|
||||
Replaces: Aggregate on unnamed_subquery, unnamed_subquery_1, unnamed_subquery_2
|
||||
One-Time Filter: false
|
||||
(7 rows)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user