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 "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 |
Referenced by read_binary_file().
|
static |
Definition at line 53 of file genfile.c.
References canonicalize_path(), DataDir, ereport, errcode(), errmsg(), ERROR, filename, GetUserId(), is_absolute_path, is_member_of_role(), Log_directory, path_contains_parent_reference(), path_is_prefix_of_path(), path_is_relative_and_below_cwd(), and text_to_cstring().
Referenced by pg_ls_dir(), pg_read_binary_file(), pg_read_file(), pg_read_file_v2(), and pg_stat_file().
Datum pg_ls_archive_statusdir | ( | PG_FUNCTION_ARGS | ) |
Definition at line 717 of file genfile.c.
References pg_ls_dir_files(), and XLOGDIR.
Datum pg_ls_dir | ( | PG_FUNCTION_ARGS | ) |
Definition at line 477 of file genfile.c.
References AllocateDir(), ReturnSetInfo::allowedModes, convert_and_check_filename(), CreateTemplateTupleDesc(), CStringGetTextDatum, ReturnSetInfo::econtext, ExprContext::ecxt_per_query_memory, ereport, errcode(), errmsg(), ERROR, FreeDir(), IsA, MemoryContextSwitchTo(), PG_ARGISNULL, PG_GETARG_BOOL, PG_GETARG_TEXT_PP, PG_NARGS, ReadDir(), ReturnSetInfo::returnMode, ReturnSetInfo::setDesc, ReturnSetInfo::setResult, SFRM_Materialize, SFRM_Materialize_Random, TupleDescInitEntry(), tuplestore_begin_heap(), tuplestore_putvalues(), values, and work_mem.
Referenced by pg_ls_dir_1arg().
Datum pg_ls_dir_1arg | ( | PG_FUNCTION_ARGS | ) |
|
static |
Definition at line 574 of file genfile.c.
References AllocateDir(), ReturnSetInfo::allowedModes, CStringGetTextDatum, ReturnSetInfo::econtext, ExprContext::ecxt_per_query_memory, elog, ereport, errcode(), errcode_for_file_access(), errmsg(), ERROR, FreeDir(), get_call_result_type(), Int64GetDatum(), IsA, MAXPGPATH, MemoryContextSwitchTo(), ReadDir(), FunctionCallInfoBaseData::resultinfo, ReturnSetInfo::returnMode, S_ISREG, ReturnSetInfo::setDesc, ReturnSetInfo::setResult, SFRM_Materialize, SFRM_Materialize_Random, snprintf, stat::st_mode, stat::st_mtime, stat::st_size, stat, time_t_to_timestamptz(), TimestampTzGetDatum, tuplestore_begin_heap(), tuplestore_putvalues(), TYPEFUNC_COMPOSITE, values, and work_mem.
Referenced by pg_ls_archive_statusdir(), pg_ls_logdir(), pg_ls_tmpdir(), and pg_ls_waldir().
Datum pg_ls_logdir | ( | PG_FUNCTION_ARGS | ) |
Definition at line 663 of file genfile.c.
References Log_directory, and pg_ls_dir_files().
|
static |
Definition at line 679 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 | ) |
Datum pg_ls_waldir | ( | PG_FUNCTION_ARGS | ) |
Definition at line 670 of file genfile.c.
References pg_ls_dir_files(), and XLOGDIR.
Datum pg_read_binary_file | ( | PG_FUNCTION_ARGS | ) |
Definition at line 322 of file genfile.c.
References convert_and_check_filename(), ereport, errcode(), errmsg(), ERROR, filename, PG_GETARG_BOOL, PG_GETARG_INT64, PG_GETARG_TEXT_PP, PG_NARGS, PG_RETURN_BYTEA_P, PG_RETURN_NULL, and read_binary_file().
Referenced by pg_read_binary_file_all(), and pg_read_binary_file_off_len().
Datum pg_read_binary_file_all | ( | PG_FUNCTION_ARGS | ) |
Datum pg_read_binary_file_off_len | ( | PG_FUNCTION_ARGS | ) |
Datum pg_read_file | ( | PG_FUNCTION_ARGS | ) |
Definition at line 239 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 | ) |
Datum pg_read_file_off_len | ( | PG_FUNCTION_ARGS | ) |
Datum pg_read_file_v2 | ( | PG_FUNCTION_ARGS | ) |
Definition at line 286 of file genfile.c.
References convert_and_check_filename(), ereport, errcode(), errmsg(), ERROR, filename, PG_GETARG_BOOL, PG_GETARG_INT64, PG_GETARG_TEXT_PP, PG_NARGS, PG_RETURN_NULL, PG_RETURN_TEXT_P, and read_text_file().
Referenced by pg_read_file_all(), and pg_read_file_off_len().
Datum pg_stat_file | ( | PG_FUNCTION_ARGS | ) |
Definition at line 392 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 105 of file genfile.c.
References AllocateFile(), Assert, buf, StringInfoData::data, enlargeStringInfo(), ereport, errcode(), errcode_for_file_access(), errmsg(), ERROR, 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(), and read_text_file().
|
static |
Definition at line 214 of file genfile.c.
References buf, pg_verifymbstr(), read_binary_file(), VARDATA, VARHDRSZ, and VARSIZE.
Referenced by pg_read_file(), and pg_read_file_v2().