mirror of
				https://github.com/postgres/postgres.git
				synced 2025-11-04 00:02:52 -05:00 
			
		
		
		
	amcheck: Fixes for right page check during unique constraint check
* Don't forget to pfree() the right page when it's to be ignored. * Report error on unexpected non-leaf right page even if this page is not to be ignored. This restores the logic which was unintendedly changed in 97e5b0026f. Reported-by: Pavel Borisov
This commit is contained in:
		
							parent
							
								
									4cf9aab214
								
							
						
					
					
						commit
						945ec4c4bc
					
				@ -1901,17 +1901,19 @@ bt_target_page_check(BtreeCheckState *state)
 | 
			
		||||
 | 
			
		||||
					if (P_IGNORE(topaque))
 | 
			
		||||
					{
 | 
			
		||||
						if (unlikely(!P_ISLEAF(topaque)))
 | 
			
		||||
							ereport(ERROR,
 | 
			
		||||
									(errcode(ERRCODE_INDEX_CORRUPTED),
 | 
			
		||||
									 errmsg("right block of leaf block is non-leaf for index \"%s\"",
 | 
			
		||||
											RelationGetRelationName(state->rel)),
 | 
			
		||||
									 errdetail_internal("Block=%u page lsn=%X/%X.",
 | 
			
		||||
														state->targetblock,
 | 
			
		||||
														LSN_FORMAT_ARGS(state->targetlsn))));
 | 
			
		||||
						else
 | 
			
		||||
							break;
 | 
			
		||||
						pfree(rightpage);
 | 
			
		||||
						break;
 | 
			
		||||
					}
 | 
			
		||||
 | 
			
		||||
					if (unlikely(!P_ISLEAF(topaque)))
 | 
			
		||||
						ereport(ERROR,
 | 
			
		||||
								(errcode(ERRCODE_INDEX_CORRUPTED),
 | 
			
		||||
								 errmsg("right block of leaf block is non-leaf for index \"%s\"",
 | 
			
		||||
										RelationGetRelationName(state->rel)),
 | 
			
		||||
								 errdetail_internal("Block=%u page lsn=%X/%X.",
 | 
			
		||||
													state->targetblock,
 | 
			
		||||
													LSN_FORMAT_ARGS(state->targetlsn))));
 | 
			
		||||
 | 
			
		||||
					itemid = PageGetItemIdCareful(state, rightblock_number,
 | 
			
		||||
												  rightpage,
 | 
			
		||||
												  rightfirstoffset);
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user