mirror of
https://github.com/postgres/postgres.git
synced 2025-07-27 12:41:57 +03:00
Prevent generation of bogus subquery scan paths.
Commit 0927d2f46d
didn't check that
consider_parallel was set for the target relation or account for
the possibility that required_outer might be non-empty.
To prevent future bugs of this ilk, add some assertions to
add_partial_path and do a bit of future-proofing of the code
recently added to recurse_set_operations.
Report by Andreas Seltenreich. Patch by Jeevan Chalke. Review
by Amit Kapila and by me.
Discussion: http://postgr.es/m/CAM2+6=U+9otsyF2fYB8x_2TBeHTR90itarqW=qAEjN-kHaC7kw@mail.gmail.com
This commit is contained in:
@ -955,4 +955,23 @@ ORDER BY 1, 2, 3;
|
||||
------------------------------+---------------------------+-------------+--------------
|
||||
(0 rows)
|
||||
|
||||
-- test interation between subquery and partial_paths
|
||||
SET LOCAL min_parallel_table_scan_size TO 0;
|
||||
CREATE VIEW tenk1_vw_sec WITH (security_barrier) AS SELECT * FROM tenk1;
|
||||
EXPLAIN (COSTS OFF)
|
||||
SELECT 1 FROM tenk1_vw_sec WHERE EXISTS (SELECT 1 WHERE unique1 = 0);
|
||||
QUERY PLAN
|
||||
-------------------------------------------------------------------
|
||||
Subquery Scan on tenk1_vw_sec
|
||||
Filter: (alternatives: SubPlan 1 or hashed SubPlan 2)
|
||||
-> Gather
|
||||
Workers Planned: 4
|
||||
-> Parallel Index Only Scan using tenk1_unique1 on tenk1
|
||||
SubPlan 1
|
||||
-> Result
|
||||
One-Time Filter: (tenk1_vw_sec.unique1 = 0)
|
||||
SubPlan 2
|
||||
-> Result
|
||||
(10 rows)
|
||||
|
||||
rollback;
|
||||
|
@ -383,4 +383,10 @@ ORDER BY 1;
|
||||
SELECT * FROM information_schema.foreign_data_wrapper_options
|
||||
ORDER BY 1, 2, 3;
|
||||
|
||||
-- test interation between subquery and partial_paths
|
||||
SET LOCAL min_parallel_table_scan_size TO 0;
|
||||
CREATE VIEW tenk1_vw_sec WITH (security_barrier) AS SELECT * FROM tenk1;
|
||||
EXPLAIN (COSTS OFF)
|
||||
SELECT 1 FROM tenk1_vw_sec WHERE EXISTS (SELECT 1 WHERE unique1 = 0);
|
||||
|
||||
rollback;
|
||||
|
Reference in New Issue
Block a user