mirror of
				https://github.com/postgres/postgres.git
				synced 2025-11-03 09:13:20 +03:00 
			
		
		
		
	Fix targetRelation initializiation in prepsecurity
In 6f9bd50eab, we modified
expand_security_quals() to tell expand_security_qual() about when the
current RTE was the targetRelation.  Unfortunately, that commit
initialized the targetRelation variable used outside of the loop over
the RTEs instead of at the start of it.
This patch moves the variable and the initialization of it into the
loop, where it should have been to begin with.
Pointed out by Dean Rasheed.
Back-patch to 9.4 as the original commit was.
			
			
This commit is contained in:
		@@ -63,7 +63,6 @@ expand_security_quals(PlannerInfo *root, List *tlist)
 | 
				
			|||||||
	Query	   *parse = root->parse;
 | 
						Query	   *parse = root->parse;
 | 
				
			||||||
	int			rt_index;
 | 
						int			rt_index;
 | 
				
			||||||
	ListCell   *cell;
 | 
						ListCell   *cell;
 | 
				
			||||||
	bool		targetRelation = false;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/*
 | 
						/*
 | 
				
			||||||
	 * Process each RTE in the rtable list.
 | 
						 * Process each RTE in the rtable list.
 | 
				
			||||||
@@ -74,7 +73,8 @@ expand_security_quals(PlannerInfo *root, List *tlist)
 | 
				
			|||||||
	rt_index = 0;
 | 
						rt_index = 0;
 | 
				
			||||||
	foreach(cell, parse->rtable)
 | 
						foreach(cell, parse->rtable)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		RangeTblEntry *rte = (RangeTblEntry *) lfirst(cell);
 | 
							bool			targetRelation = false;
 | 
				
			||||||
 | 
							RangeTblEntry  *rte = (RangeTblEntry *) lfirst(cell);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		rt_index++;
 | 
							rt_index++;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user