diff --git a/src/backend/catalog/Catalog.pm b/src/backend/catalog/Catalog.pm
index eee7cb3..1b31cdd 100644
*** a/src/backend/catalog/Catalog.pm
--- b/src/backend/catalog/Catalog.pm
*************** package Catalog;
*** 16,21 ****
--- 16,24 ----
  use strict;
  use warnings;
  
+ use File::Compare;
+ 
+ 
  # Parses a catalog header file into a data structure describing the schema
  # of the catalog.
  sub ParseHeader
*************** sub AddDefaultValues
*** 336,350 ****
  }
  
  # Rename temporary files to final names.
! # Call this function with the final file name and the .tmp extension
  # Note: recommended extension is ".tmp$$", so that parallel make steps
! # can't use the same temp files
  sub RenameTempFile
  {
  	my $final_name = shift;
  	my $extension  = shift;
  	my $temp_name  = $final_name . $extension;
! 	rename($temp_name, $final_name) || die "rename: $temp_name: $!";
  }
  
  # Find a symbol defined in a particular header file and extract the value.
--- 339,367 ----
  }
  
  # Rename temporary files to final names.
! # Call this function with the final file name and the .tmp extension.
! #
! # If the final file already exists and has identical contents, don't
! # overwrite it; this behavior avoids unnecessary recompiles due to updating
! # the mod date on header files.
! #
  # Note: recommended extension is ".tmp$$", so that parallel make steps
! # can't use the same temp files.
  sub RenameTempFile
  {
  	my $final_name = shift;
  	my $extension  = shift;
  	my $temp_name  = $final_name . $extension;
! 
! 	if (-f $final_name &&
! 		compare($temp_name, $final_name) == 0)
! 	{
! 		unlink $temp_name || die "unlink: $temp_name: $!";
! 	}
! 	else
! 	{
! 		rename($temp_name, $final_name) || die "rename: $temp_name: $!";
! 	}
  }
  
  # Find a symbol defined in a particular header file and extract the value.
