Support pg_read_[binary_]file (filename, missing_ok).
Tom Lane <tgl@sss.pgh.pa.us>
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
| Path | Change | +/− |
|---|---|---|
| doc/src/sgml/func.sgml | modified | +14 −4 |
| src/backend/catalog/system_functions.sql | modified | +4 −0 |
| src/backend/utils/adt/genfile.c | modified | +135 −65 |
| src/include/catalog/catversion.h | modified | +1 −1 |
| src/include/catalog/pg_proc.dat | modified | +10 −2 |
| src/test/regress/expected/misc_functions.out | modified | +64 −0 |
| src/test/regress/sql/misc_functions.sql | modified | +26 −0 |
Documentation touched
Discussion
- Inconvenience of pg_read_binary_file() 13 messages · 2022-06-07 → 2022-08-01