Re: File API cleanup

From: Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>
To: Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: File API cleanup
Date: 2022-12-01 15:10:39
Message-ID: 4ee0c899-c7fd-d3af-0800-0c1b5067c7e5@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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.)

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2022-12-01 15:18:21 pg_upgrade: Make testing different transfer modes easier
Previous Message Peter Eisentraut 2022-12-01 14:58:39 Re: Documentation for building with meson