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

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

Commit: 283129e325b721a5a62227f20d7e3d149b379c73
Author: Tom Lane <tgl@sss.pgh.pa.us>
Date: 2022-07-29T19:38:49Z
Releases: 16.0
Support pg_read_[binary_]file (filename, missing_ok).

There wasn't an especially nice way to read all of a file while
passing missing_ok = true.  Add an additional overloaded variant
to support that use-case.

While here, refactor the C code to avoid a rats-nest of PG_NARGS
checks, instead handling the argument collection in the outer
wrapper functions.  It's a bit longer this way, but far more
straightforward.

(Upon looking at the code coverage report for genfile.c, I was
impelled to also add a test case for pg_stat_file() -- tgl)

Kyotaro Horiguchi

Discussion: https://postgr.es/m/20220607.160520.1984541900138970018.horikyota.ntt@gmail.com

Files

Documentation touched

Discussion