Add BufFileRead variants with short read and EOF detection

From: Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Add BufFileRead variants with short read and EOF detection
Date: 2022-12-28 10:47:02
Message-ID: f3501945-c591-8cc3-5ef0-b72a2e0eaa9c@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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().

Attachment Content-Type Size
0001-Add-BufFileRead-variants-with-short-read-and-EOF-det.patch text/plain 16.3 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Maxim Orlov 2022-12-28 10:58:54 Re: Add SHELL_EXIT_CODE to psql
Previous Message Maxim Orlov 2022-12-28 10:14:16 Re: Add 64-bit XIDs into PostgreSQL 15