Re: File API cleanup - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Re: File API cleanup
Date
Msg-id 4ee0c899-c7fd-d3af-0800-0c1b5067c7e5@enterprisedb.com
Whole thread Raw
In response to Re: File API cleanup  (Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>)
List pgsql-hackers
On 01.12.22 09:55, Bharath Rupireddy wrote:
> can we have a generic,
> single function file_exists() in fd.c/file_utils.c so that both
> backend and frontend code can use it? I see there are 3 uses and
> definitions of it in jit.c, dfmgr.c and pg_regress.c. This will reduce
> the code duplication. Thoughts?

Well, the first problem with that would be that all three of those 
implementations are slightly different.  Maybe that is intentional, or 
maybe not, in which case a common implementation might be beneficial.

(Another thing to consider is that checking whether a file exists is not 
often actually useful.  If you want to use the file, you should just 
open it and then check for any errors.  The cases above have special 
requirements, so there obviously are uses, but I'm not sure how many in 
the long run.)




pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: Documentation for building with meson
Next
From: Peter Eisentraut
Date:
Subject: pg_upgrade: Make testing different transfer modes easier