PostgreSQL Source Code
git master
|
#include "postgres.h"
#include <sys/file.h>
#include <sys/stat.h>
#include <unistd.h>
#include <dirent.h>
#include "access/htup_details.h"
#include "access/xlog_internal.h"
#include "catalog/pg_authid.h"
#include "catalog/pg_tablespace_d.h"
#include "catalog/pg_type.h"
#include "funcapi.h"
#include "mb/pg_wchar.h"
#include "miscadmin.h"
#include "postmaster/syslogger.h"
#include "replication/slot.h"
#include "storage/fd.h"
#include "utils/acl.h"
#include "utils/builtins.h"
#include "utils/memutils.h"
#include "utils/syscache.h"
#include "utils/timestamp.h"
Go to the source code of this file.
Macros | |
#define | MIN_READ_SIZE 4096 |
#define MIN_READ_SIZE 4096 |
|
static |
Definition at line 54 of file genfile.c.
References arg, canonicalize_path(), DataDir, ereport, errcode(), errmsg(), ERROR, filename, GetUserId(), has_privs_of_role(), is_absolute_path, Log_directory, path_is_prefix_of_path(), path_is_relative_and_below_cwd(), and text_to_cstring().
Referenced by pg_ls_dir(), pg_read_binary_file_common(), pg_read_file(), pg_read_file_common(), and pg_stat_file().
Datum pg_ls_archive_statusdir | ( | PG_FUNCTION_ARGS | ) |
Definition at line 733 of file genfile.c.
References pg_ls_dir_files(), and XLOGDIR.
Datum pg_ls_dir | ( | PG_FUNCTION_ARGS | ) |
Definition at line 544 of file genfile.c.
References AllocateDir(), convert_and_check_filename(), CStringGetTextDatum, FreeDir(), InitMaterializedSRF(), MAT_SRF_USE_EXPECTED_DESC, PG_ARGISNULL, PG_GETARG_BOOL, PG_GETARG_TEXT_PP, PG_NARGS, ReadDir(), ReturnSetInfo::setDesc, ReturnSetInfo::setResult, tuplestore_putvalues(), and values.
Referenced by pg_ls_dir_1arg().
Datum pg_ls_dir_1arg | ( | PG_FUNCTION_ARGS | ) |
|
static |
Definition at line 616 of file genfile.c.
References AllocateDir(), CStringGetTextDatum, ereport, errcode_for_file_access(), errmsg(), ERROR, FreeDir(), InitMaterializedSRF(), Int64GetDatum(), MAXPGPATH, ReadDir(), FunctionCallInfoBaseData::resultinfo, S_ISREG, ReturnSetInfo::setDesc, ReturnSetInfo::setResult, snprintf, stat::st_mode, stat::st_mtime, stat::st_size, stat, time_t_to_timestamptz(), TimestampTzGetDatum(), tuplestore_putvalues(), and values.
Referenced by pg_ls_archive_statusdir(), pg_ls_logdir(), pg_ls_logicalmapdir(), pg_ls_logicalsnapdir(), pg_ls_replslotdir(), pg_ls_tmpdir(), and pg_ls_waldir().
Datum pg_ls_logdir | ( | PG_FUNCTION_ARGS | ) |
Definition at line 679 of file genfile.c.
References Log_directory, and pg_ls_dir_files().
Datum pg_ls_logicalmapdir | ( | PG_FUNCTION_ARGS | ) |
Definition at line 751 of file genfile.c.
References pg_ls_dir_files().
Datum pg_ls_logicalsnapdir | ( | PG_FUNCTION_ARGS | ) |
Definition at line 742 of file genfile.c.
References pg_ls_dir_files().
Datum pg_ls_replslotdir | ( | PG_FUNCTION_ARGS | ) |
Definition at line 761 of file genfile.c.
References ereport, errcode(), errmsg(), ERROR, MAXPGPATH, PG_GETARG_TEXT_PP, pg_ls_dir_files(), SearchNamedReplicationSlot(), snprintf, and text_to_cstring().
|
static |
Definition at line 695 of file genfile.c.
References ereport, errcode(), errmsg(), ERROR, MAXPGPATH, ObjectIdGetDatum(), pg_ls_dir_files(), SearchSysCacheExists1, TABLESPACEOID, and TempTablespacePath().
Referenced by pg_ls_tmpdir_1arg(), and pg_ls_tmpdir_noargs().
Datum pg_ls_tmpdir_1arg | ( | PG_FUNCTION_ARGS | ) |
Datum pg_ls_tmpdir_noargs | ( | PG_FUNCTION_ARGS | ) |
Definition at line 714 of file genfile.c.
References pg_ls_tmpdir().
Datum pg_ls_waldir | ( | PG_FUNCTION_ARGS | ) |
Definition at line 686 of file genfile.c.
References pg_ls_dir_files(), and XLOGDIR.
Datum pg_read_binary_file_all | ( | PG_FUNCTION_ARGS | ) |
Definition at line 427 of file genfile.c.
References PG_GETARG_TEXT_PP, pg_read_binary_file_common(), PG_RETURN_BYTEA_P, and PG_RETURN_NULL.
Datum pg_read_binary_file_all_missing | ( | PG_FUNCTION_ARGS | ) |
Definition at line 441 of file genfile.c.
References PG_GETARG_BOOL, PG_GETARG_TEXT_PP, pg_read_binary_file_common(), PG_RETURN_BYTEA_P, and PG_RETURN_NULL.
|
static |
Definition at line 306 of file genfile.c.
References Assert(), convert_and_check_filename(), ereport, errcode(), errmsg(), ERROR, and read_binary_file().
Referenced by pg_read_binary_file_all(), pg_read_binary_file_all_missing(), pg_read_binary_file_off_len(), and pg_read_binary_file_off_len_missing().
Datum pg_read_binary_file_off_len | ( | PG_FUNCTION_ARGS | ) |
Definition at line 394 of file genfile.c.
References PG_GETARG_INT64, PG_GETARG_TEXT_PP, pg_read_binary_file_common(), PG_RETURN_BYTEA_P, and PG_RETURN_NULL.
Datum pg_read_binary_file_off_len_missing | ( | PG_FUNCTION_ARGS | ) |
Definition at line 410 of file genfile.c.
References PG_GETARG_BOOL, PG_GETARG_INT64, PG_GETARG_TEXT_PP, pg_read_binary_file_common(), PG_RETURN_BYTEA_P, and PG_RETURN_NULL.
Datum pg_read_file | ( | PG_FUNCTION_ARGS | ) |
Definition at line 236 of file genfile.c.
References convert_and_check_filename(), ereport, errcode(), errhint(), errmsg(), ERROR, filename, PG_GETARG_BOOL, PG_GETARG_INT64, PG_GETARG_TEXT_PP, PG_NARGS, PG_RETURN_NULL, PG_RETURN_TEXT_P, read_text_file(), and superuser().
Datum pg_read_file_all | ( | PG_FUNCTION_ARGS | ) |
Definition at line 365 of file genfile.c.
References PG_GETARG_TEXT_PP, pg_read_file_common(), PG_RETURN_NULL, and PG_RETURN_TEXT_P.
Datum pg_read_file_all_missing | ( | PG_FUNCTION_ARGS | ) |
Definition at line 379 of file genfile.c.
References PG_GETARG_BOOL, PG_GETARG_TEXT_PP, pg_read_file_common(), PG_RETURN_NULL, and PG_RETURN_TEXT_P.
|
static |
Definition at line 286 of file genfile.c.
References Assert(), convert_and_check_filename(), ereport, errcode(), errmsg(), ERROR, and read_text_file().
Referenced by pg_read_file_all(), pg_read_file_all_missing(), pg_read_file_off_len(), and pg_read_file_off_len_missing().
Datum pg_read_file_off_len | ( | PG_FUNCTION_ARGS | ) |
Definition at line 331 of file genfile.c.
References PG_GETARG_INT64, PG_GETARG_TEXT_PP, pg_read_file_common(), PG_RETURN_NULL, and PG_RETURN_TEXT_P.
Datum pg_read_file_off_len_missing | ( | PG_FUNCTION_ARGS | ) |
Definition at line 347 of file genfile.c.
References PG_GETARG_BOOL, PG_GETARG_INT64, PG_GETARG_TEXT_PP, pg_read_file_common(), PG_RETURN_NULL, and PG_RETURN_TEXT_P.
Datum pg_stat_file | ( | PG_FUNCTION_ARGS | ) |
Definition at line 459 of file genfile.c.
References BlessTupleDesc(), BoolGetDatum(), convert_and_check_filename(), CreateTemplateTupleDesc(), ereport, errcode_for_file_access(), errmsg(), ERROR, filename, heap_form_tuple(), HeapTupleGetDatum(), Int64GetDatum(), pfree(), PG_GETARG_BOOL, PG_GETARG_TEXT_PP, PG_NARGS, PG_RETURN_DATUM, PG_RETURN_NULL, S_ISDIR, stat::st_atime, stat::st_ctime, stat::st_mode, stat::st_mtime, stat::st_size, stat, time_t_to_timestamptz(), TimestampTzGetDatum(), TupleDescInitEntry(), and values.
Referenced by pg_stat_file_1arg().
Datum pg_stat_file_1arg | ( | PG_FUNCTION_ARGS | ) |
|
static |
Definition at line 103 of file genfile.c.
References AllocateFile(), Assert(), buf, StringInfoData::data, enlargeStringInfo(), ereport, errcode(), errcode_for_file_access(), errmsg(), ERROR, filename, FreeFile(), fseeko, initStringInfo(), StringInfoData::len, MaxAllocSize, StringInfoData::maxlen, MIN_READ_SIZE, palloc(), PG_BINARY_R, SET_VARSIZE, VARDATA, and VARHDRSZ.
Referenced by pg_read_binary_file_common(), and read_text_file().
|
static |
Definition at line 211 of file genfile.c.
References buf, filename, pg_verifymbstr(), read_binary_file(), VARDATA, VARHDRSZ, and VARSIZE.
Referenced by pg_read_file(), and pg_read_file_common().