Add missing_ok option to the SQL functions for reading files.
Heikki Linnakangas <heikki.linnakangas@iki.fi>
Add missing_ok option to the SQL functions for reading files. This makes it possible to use the functions without getting errors, if there is a chance that the file might be removed or renamed concurrently. pg_rewind needs to do just that, although this could be useful for other purposes too. (The changes to pg_rewind to use these functions will come in a separate commit.) The read_binary_file() function isn't very well-suited for extensions.c's purposes anymore, if it ever was. So bite the bullet and make a copy of it in extension.c, tailored for that use case. This seems better than the accidental code reuse, even if it's a some more lines of code. Michael Paquier, with plenty of kibitzing by me.
Files
| Path | Change | +/− |
|---|---|---|
| doc/src/sgml/func.sgml | modified | +31 −11 |
| src/backend/commands/extension.c | modified | +56 −13 |
| src/backend/utils/adt/genfile.c | modified | +168 −69 |
| src/include/catalog/catversion.h | modified | +1 −1 |
| src/include/catalog/pg_proc.h | modified | +12 −4 |
| src/include/utils/builtins.h | modified | +4 −2 |