mirror of
				https://github.com/postgres/postgres.git
				synced 2025-10-25 13:17:41 +03:00 
			
		
		
		
	An assertion test added in commit049ef33could fail when pg_prewarm() was called on objects without storage, such as partitioned tables. This resulted in the following failure in assert-enabled builds: Failed Assert("RelFileNumberIsValid(rlocator.relNumber)") Note that, in non-assert builds, pg_prewarm() just failed with an error in that case, so there was no ill effect in practice. This commit fixes the issue by having pg_prewarm() raise an error early if the specified object has no storage. This approach is similar to the fix in commit4623d7144for pg_freespacemap. Back-patched to v17, where the issue was introduced. Author: Masahiro Ikeda <ikedamsh@oss.nttdata.com> Reviewed-by: Dilip Kumar <dilipbalaut@gmail.com> Reviewed-by: Richard Guo <guofenglinux@gmail.com> Reviewed-by: Fujii Masao <masao.fujii@gmail.com> Discussion: https://postgr.es/m/e082e6027610fd0a4091ae6d033aa117@oss.nttdata.com Backpatch-through: 17
		
			
				
	
	
		
			43 lines
		
	
	
		
			857 B
		
	
	
	
		
			Meson
		
	
	
	
	
	
			
		
		
	
	
			43 lines
		
	
	
		
			857 B
		
	
	
	
		
			Meson
		
	
	
	
	
	
| # Copyright (c) 2022-2025, PostgreSQL Global Development Group
 | |
| 
 | |
| pg_prewarm_sources = files(
 | |
|   'autoprewarm.c',
 | |
|   'pg_prewarm.c',
 | |
| )
 | |
| 
 | |
| if host_system == 'windows'
 | |
|   pg_prewarm_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
 | |
|     '--NAME', 'pg_prewarm',
 | |
|     '--FILEDESC', 'pg_prewarm - preload relation data into system buffer cache',])
 | |
| endif
 | |
| 
 | |
| pg_prewarm = shared_module('pg_prewarm',
 | |
|   pg_prewarm_sources,
 | |
|   kwargs: contrib_mod_args,
 | |
| )
 | |
| contrib_targets += pg_prewarm
 | |
| 
 | |
| install_data(
 | |
|   'pg_prewarm--1.0--1.1.sql',
 | |
|   'pg_prewarm--1.1--1.2.sql',
 | |
|   'pg_prewarm--1.1.sql',
 | |
|   'pg_prewarm.control',
 | |
|   kwargs: contrib_data_args,
 | |
| )
 | |
| 
 | |
| tests += {
 | |
|   'name': 'pg_prewarm',
 | |
|   'sd': meson.current_source_dir(),
 | |
|   'bd': meson.current_build_dir(),
 | |
|   'regress': {
 | |
|     'sql': [
 | |
|       'pg_prewarm',
 | |
|     ],
 | |
|   },
 | |
|   'tap': {
 | |
|     'tests': [
 | |
|       't/001_basic.pl',
 | |
|     ],
 | |
|   },
 | |
| }
 |