mirror of
				https://github.com/postgres/postgres.git
				synced 2025-10-31 00:03:57 -04:00 
			
		
		
		
	Restore pre-7.1 behavior of allowing DROP of a table whose underlying
physical file has disappeared. There is no really good reason why relcache should be opening the underlying file at all, AFAICS. In any case we needn't raise a hard error here.
This commit is contained in:
		
							parent
							
								
									244fd47124
								
							
						
					
					
						commit
						503c80d2a0
					
				
							
								
								
									
										15
									
								
								src/backend/utils/cache/relcache.c
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										15
									
								
								src/backend/utils/cache/relcache.c
									
									
									
									
										vendored
									
									
								
							| @ -8,7 +8,7 @@ | |||||||
|  * |  * | ||||||
|  * |  * | ||||||
|  * IDENTIFICATION |  * IDENTIFICATION | ||||||
|  *	  $Header: /cvsroot/pgsql/src/backend/utils/cache/relcache.c,v 1.130 2001/03/23 04:49:55 momjian Exp $ |  *	  $Header: /cvsroot/pgsql/src/backend/utils/cache/relcache.c,v 1.131 2001/04/02 23:30:04 tgl Exp $ | ||||||
|  * |  * | ||||||
|  *------------------------------------------------------------------------- |  *------------------------------------------------------------------------- | ||||||
|  */ |  */ | ||||||
| @ -1125,12 +1125,21 @@ RelationBuildDesc(RelationBuildDescInfo buildinfo, | |||||||
| 	relation->rd_node.relNode = relation->rd_rel->relfilenode; | 	relation->rd_node.relNode = relation->rd_rel->relfilenode; | ||||||
| 
 | 
 | ||||||
| 	/*
 | 	/*
 | ||||||
| 	 * open the relation and assign the file descriptor returned by the | 	 * Open the relation and assign the file descriptor returned by the | ||||||
| 	 * storage manager code to rd_fd. | 	 * storage manager code to rd_fd. | ||||||
| 	 * | 	 * | ||||||
|  | 	 * We do not raise a hard error if we fail to open the relation at this | ||||||
|  | 	 * point.  If we did, it would be impossible to drop a relation whose | ||||||
|  | 	 * underlying physical file had disappeared. | ||||||
| 	 */ | 	 */ | ||||||
| 	if (relation->rd_rel->relkind != RELKIND_VIEW) | 	if (relation->rd_rel->relkind != RELKIND_VIEW) | ||||||
| 		relation->rd_fd = smgropen(DEFAULT_SMGR, relation, false); | 	{ | ||||||
|  | 		relation->rd_fd = smgropen(DEFAULT_SMGR, relation, true); | ||||||
|  | 		Assert(relation->rd_fd >= -1); | ||||||
|  | 		if (relation->rd_fd == -1) | ||||||
|  | 			elog(NOTICE, "RelationBuildDesc: can't open %s: %m", | ||||||
|  | 				 RelationGetRelationName(relation)); | ||||||
|  | 	} | ||||||
| 	else | 	else | ||||||
| 		relation->rd_fd = -1; | 		relation->rd_fd = -1; | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user