Re: Inconvenience of pg_read_binary_file()

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Cc: michael@paquier.xyz, pgsql-hackers@postgresql.org
Date: 2022-07-29T19:44:25Z
Lists: pgsql-hackers
Kyotaro Horiguchi <horikyota.ntt@gmail.com> writes:
> Please find the attached.  I added some regression tests for both
> pg_read_file() and pg_read_binary_file().

Yeah, I definitely find this way cleaner even if it's a bit more verbose.

I think that the PG_RETURN_NULL code paths are not reachable in the
wrappers that don't have missing_ok.  I concur with your decision
to write them all the same, though.

Pushed after some fooling with the docs and test cases.  (Notably,
I do not think we can assume that pg_hba.conf exists in $PGDATA; some
installations keep it elsewhere.  I used postgresql.auto.conf instead.)

			regards, tom lane



Commits

  1. Adjust new pg_read_file() test cases for more portability.

  2. Support pg_read_[binary_]file (filename, missing_ok).