mirror of
				https://github.com/postgres/postgres.git
				synced 2025-11-03 09:13:20 +03:00 
			
		
		
		
	Teach planner about some cases where a restriction clause can be
propagated inside an outer join. In particular, given LEFT JOIN ON (A = B) WHERE A = constant, we cannot conclude that B = constant at the top level (B might be null instead), but we can nonetheless put a restriction B = constant into the quals for B's relation, since no inner-side rows not meeting that condition can contribute to the final result. Similarly, given FULL JOIN USING (J) WHERE J = constant, we can't directly conclude that either input J variable = constant, but it's OK to push such quals into each input rel. Per recent gripe from Kim Bisgaard. Along the way, remove 'valid_everywhere' flag from RestrictInfo, as on closer analysis it was not being used for anything, and was defined backwards anyway.
This commit is contained in:
		@@ -10,7 +10,7 @@
 | 
			
		||||
 *
 | 
			
		||||
 *
 | 
			
		||||
 * IDENTIFICATION
 | 
			
		||||
 *	  $PostgreSQL: pgsql/src/backend/optimizer/plan/createplan.c,v 1.192 2005/06/10 22:25:36 tgl Exp $
 | 
			
		||||
 *	  $PostgreSQL: pgsql/src/backend/optimizer/plan/createplan.c,v 1.193 2005/07/02 23:00:41 tgl Exp $
 | 
			
		||||
 *
 | 
			
		||||
 *-------------------------------------------------------------------------
 | 
			
		||||
 */
 | 
			
		||||
@@ -1176,8 +1176,7 @@ create_nestloop_plan(PlannerInfo *root,
 | 
			
		||||
			List	   *bitmapclauses;
 | 
			
		||||
 | 
			
		||||
			bitmapclauses =
 | 
			
		||||
				make_restrictinfo_from_bitmapqual(innerpath->bitmapqual,
 | 
			
		||||
												  true, true);
 | 
			
		||||
				make_restrictinfo_from_bitmapqual(innerpath->bitmapqual, true);
 | 
			
		||||
			joinrestrictclauses =
 | 
			
		||||
				select_nonredundant_join_clauses(root,
 | 
			
		||||
												 joinrestrictclauses,
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user