diff --git a/src/backend/utils/cache/relcache.c b/src/backend/utils/cache/relcache.c index fd05615e76..7f5b57f783 100644 --- a/src/backend/utils/cache/relcache.c +++ b/src/backend/utils/cache/relcache.c @@ -6199,7 +6199,17 @@ write_relcache_init_file(bool shared) DatabasePath, RELCACHE_INIT_FILENAME); } - unlink(tempfilename); /* in case it exists w/wrong permissions */ + /* in case it exists w/wrong permissions */ + if (unlink(tempfilename) && errno != ENOENT) + { + ereport(WARNING, + (errcode_for_file_access(), + errmsg("could not unlink relation-cache initialization file \"%s\": %m", + tempfilename), + errdetail("Continuing anyway, but there's something wrong."))); + return; + } + fp = AllocateFile(tempfilename, PG_BINARY_W); if (fp == NULL)