mirror of
				https://github.com/postgres/postgres.git
				synced 2025-11-03 09:13:20 +03:00 
			
		
		
		
	Restore comments in ChangeVarNodesExtended()
This commit restores comments in ChangeVarNodesExtended(), which were
accidentally removed by fc069a3a63.
Reported-by: Richard Guo <guofenglinux@gmail.com>
Discussion: https://postgr.es/m/CAMbWs49PE3CvnV8vrQ0Dr%3DHqgZZmX0tdNbzVNJxqc8yg-8kDQQ%40mail.gmail.com
			
			
This commit is contained in:
		@@ -758,10 +758,23 @@ ChangeVarNodesExtended(Node *node, int rt_index, int new_index,
 | 
				
			|||||||
	context.sublevels_up = sublevels_up;
 | 
						context.sublevels_up = sublevels_up;
 | 
				
			||||||
	context.change_RangeTblRef = change_RangeTblRef;
 | 
						context.change_RangeTblRef = change_RangeTblRef;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						/*
 | 
				
			||||||
 | 
						 * Must be prepared to start with a Query or a bare expression tree; if
 | 
				
			||||||
 | 
						 * it's a Query, go straight to query_tree_walker to make sure that
 | 
				
			||||||
 | 
						 * sublevels_up doesn't get incremented prematurely.
 | 
				
			||||||
 | 
						 */
 | 
				
			||||||
	if (node && IsA(node, Query))
 | 
						if (node && IsA(node, Query))
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		Query	   *qry = (Query *) node;
 | 
							Query	   *qry = (Query *) node;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							/*
 | 
				
			||||||
 | 
							 * If we are starting at a Query, and sublevels_up is zero, then we
 | 
				
			||||||
 | 
							 * must also fix rangetable indexes in the Query itself --- namely
 | 
				
			||||||
 | 
							 * resultRelation, mergeTargetRelation, exclRelIndex  and rowMarks
 | 
				
			||||||
 | 
							 * entries.  sublevels_up cannot be zero when recursing into a
 | 
				
			||||||
 | 
							 * subquery, so there's no need to have the same logic inside
 | 
				
			||||||
 | 
							 * ChangeVarNodes_walker.
 | 
				
			||||||
 | 
							 */
 | 
				
			||||||
		if (sublevels_up == 0)
 | 
							if (sublevels_up == 0)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			ListCell   *l;
 | 
								ListCell   *l;
 | 
				
			||||||
@@ -772,6 +785,7 @@ ChangeVarNodesExtended(Node *node, int rt_index, int new_index,
 | 
				
			|||||||
			if (qry->mergeTargetRelation == rt_index)
 | 
								if (qry->mergeTargetRelation == rt_index)
 | 
				
			||||||
				qry->mergeTargetRelation = new_index;
 | 
									qry->mergeTargetRelation = new_index;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								/* this is unlikely to ever be used, but ... */
 | 
				
			||||||
			if (qry->onConflict && qry->onConflict->exclRelIndex == rt_index)
 | 
								if (qry->onConflict && qry->onConflict->exclRelIndex == rt_index)
 | 
				
			||||||
				qry->onConflict->exclRelIndex = new_index;
 | 
									qry->onConflict->exclRelIndex = new_index;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user