Re: merge file_exists_in_directory and _fileExistsInDirectory functions and move into common file dumputils.c

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Mahendra Singh Thalor <mahi6run(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Andrew Dunstan <andrew(at)dunslane(dot)net>
Subject: Re: merge file_exists_in_directory and _fileExistsInDirectory functions and move into common file dumputils.c
Date: 2025-04-11 04:51:08
Message-ID: Z_ifvD9LSYfavtAR@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2025-04-11 05:08:50 Re: Silence resource leaks alerts
Previous Message Michael Paquier 2025-04-11 04:26:10 Re: stats.sql fails during installcheck on mac