Re: Add BufFileRead variants with short read and EOF detection

From: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
To: Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Add BufFileRead variants with short read and EOF detection
Date: 2023-01-02 12:13:29
Message-ID: CAA4eK1+YKd8HO8uUE+x0z8nUO_VDkGF2VQ168V-VyoQyOpE7Zg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Dec 28, 2022 at 4:17 PM Peter Eisentraut
<peter(dot)eisentraut(at)enterprisedb(dot)com> wrote:
>
> Most callers of BufFileRead() want to check whether they read the full
> specified length. Checking this at every call site is very tedious.
> This patch provides additional variants BufFileReadExact() and
> BufFileReadMaybeEOF() that include the length checks.
>
> I considered changing BufFileRead() itself, but this function is also
> used in extensions, and so changing the behavior like this would create
> a lot of problems there. The new names are analogous to the existing
> LogicalTapeReadExact().
>

+1 for the new APIs. I have noticed that some of the existing places
use %m and the file path in messages which are not used in the new
common function.

--
With Regards,
Amit Kapila.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Dean Rasheed 2023-01-02 12:13:59 Bug in check for unreachable MERGE WHEN clauses
Previous Message Lukas Fittl 2023-01-02 11:36:04 Sampling-based timing for EXPLAIN ANALYZE