Inconvenience of pg_read_binary_file()

From: Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Inconvenience of pg_read_binary_file()
Date: 2022-06-07 07:05:20
Message-ID: 20220607.160520.1984541900138970018.horikyota.ntt@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

If I want to read a file that I'm not sure of the existence but I want
to read the whole file if exists, I would call
pg_read_binary_file('path', 0, -1, true) but unfortunately this
doesn't work.

Does it make sense to change the function so as to accept the
parameter specification above? Or the arguments could be ('path',
null, null, true) but (0,-1) is simpler considering the
characteristics of the function.

(We could also rearrange the the parameter order as "filename,
missing_ok, offset, length" but that is simply confusing..)

If it is, pg_read_file() is worth receive the same modification and
I'll post the version containing doc part.

regards.

--
Kyotaro Horiguchi
NTT Open Source Software Center

Attachment Content-Type Size
pg_read_binary_file_modify.patch text/x-patch 613 bytes

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Kyotaro Horiguchi 2022-06-07 07:05:47 Re: pg_rewind: warn when checkpoint hasn't happened after promotion
Previous Message Chinmay Kanchi 2022-06-07 05:41:52 An inverted index using roaring bitmaps