mirror of
https://github.com/postgres/postgres.git
synced 2025-12-21 05:21:08 +03:00
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.
This commit is contained in:
@@ -469,14 +469,16 @@ extern Datum pg_filenode_relation(PG_FUNCTION_ARGS);
|
||||
extern Datum pg_relation_filepath(PG_FUNCTION_ARGS);
|
||||
|
||||
/* genfile.c */
|
||||
extern bytea *read_binary_file(const char *filename,
|
||||
int64 seek_offset, int64 bytes_to_read);
|
||||
extern Datum pg_stat_file(PG_FUNCTION_ARGS);
|
||||
extern Datum pg_stat_file_1arg(PG_FUNCTION_ARGS);
|
||||
extern Datum pg_read_file(PG_FUNCTION_ARGS);
|
||||
extern Datum pg_read_file_off_len(PG_FUNCTION_ARGS);
|
||||
extern Datum pg_read_file_all(PG_FUNCTION_ARGS);
|
||||
extern Datum pg_read_binary_file(PG_FUNCTION_ARGS);
|
||||
extern Datum pg_read_binary_file_off_len(PG_FUNCTION_ARGS);
|
||||
extern Datum pg_read_binary_file_all(PG_FUNCTION_ARGS);
|
||||
extern Datum pg_ls_dir(PG_FUNCTION_ARGS);
|
||||
extern Datum pg_ls_dir_1arg(PG_FUNCTION_ARGS);
|
||||
|
||||
/* misc.c */
|
||||
extern Datum current_database(PG_FUNCTION_ARGS);
|
||||
|
||||
Reference in New Issue
Block a user