Re: merge file_exists_in_directory and _fileExistsInDirectory functions and move into common file dumputils.c
Michael Paquier <michael@paquier.xyz>
From: Michael Paquier <michael@paquier.xyz>
To: Mahendra Singh Thalor <mahi6run@gmail.com>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>, Andrew Dunstan <andrew@dunslane.net>
Date: 2025-04-11T04:51:08Z
Lists: pgsql-hackers
On Thu, Apr 10, 2025 at 10:41:33PM +0530, Mahendra Singh Thalor wrote: > We have file_exists_in_directory function in pg_restore.c and same > code we are using in _fileExistsInDirectory function in pg_backup_archiver.c > also. > Here, I am attaching a patch to move these duplicate functions into > dumputils.c file Indeed. I don't quite see a reason not to remove this duplication, and both routines in pg_restore.c and the pg_dump code are the same. dumputils.h is only used by pg_dump and pg_dumpall, and its top comment documents exactly that, so using this location for a routine that would be used by a pg_restore path is a bit strange to me for something that is qualified as a "dump" routine in your patch. Perhaps we should just use a more centralized place, like file_utils.c so as all frontends could benefit of it? Please make sure to add it to the next commit fest that will begin in July, this refactoring proposal is too late to be considered for v18. -- Michael