26#include "catalog/pg_tablespace_d.h"
84 errmsg(
"absolute path not allowed")));
89 errmsg(
"path must be in or below the data directory")));
114 errmsg(
"requested length too large")));
123 errmsg(
"could not open file \"%s\" for reading: %m",
155#define MIN_READ_SIZE 4096
171 errmsg(
"file length too large")));
185 (
size_t) (
sbuf.maxlen -
sbuf.len - 1), file);
248 errmsg(
"requested length cannot be negative")));
269 errmsg(
"requested length cannot be negative")));
422 bool missing_ok =
false;
459 memset(isnull,
false,
sizeof(isnull));
465#if !defined(WIN32) && !defined(__CYGWIN__)
502 bool missing_ok =
false;
600 if (
de->d_name[0] ==
'.')
604 snprintf(path,
sizeof(path),
"%s/%s", dir,
de->d_name);
612 errmsg(
"could not stat file \"%s\": %m", path)));
622 memset(nulls, 0,
sizeof(nulls));
656 errmsg(
"tablespace with OID %u does not exist",
739 errmsg(
"replication slot \"%s\" does not exist",
bool has_privs_of_role(Oid member, Oid role)
TimestampTz time_t_to_timestamptz(pg_time_t tm)
static Datum values[MAXATTR]
#define CStringGetTextDatum(s)
#define Assert(condition)
int errcode_for_file_access(void)
int errcode(int sqlerrcode)
int errmsg(const char *fmt,...)
#define ereport(elevel,...)
TupleDesc BlessTupleDesc(TupleDesc tupdesc)
DIR * AllocateDir(const char *dirname)
struct dirent * ReadDir(DIR *dir, const char *dirname)
FILE * AllocateFile(const char *name, const char *mode)
void TempTablespacePath(char *path, Oid tablespace)
#define PG_GETARG_TEXT_PP(n)
#define PG_RETURN_BYTEA_P(x)
#define PG_GETARG_INT64(n)
#define PG_RETURN_TEXT_P(x)
#define PG_GETARG_BOOL(n)
#define PG_RETURN_DATUM(x)
void InitMaterializedSRF(FunctionCallInfo fcinfo, bits32 flags)
static Datum HeapTupleGetDatum(const HeapTupleData *tuple)
#define MAT_SRF_USE_EXPECTED_DESC
Datum pg_read_file_off_len_missing(PG_FUNCTION_ARGS)
Datum pg_ls_summariesdir(PG_FUNCTION_ARGS)
Datum pg_read_file_off_len(PG_FUNCTION_ARGS)
Datum pg_read_binary_file_all_missing(PG_FUNCTION_ARGS)
Datum pg_read_binary_file_all(PG_FUNCTION_ARGS)
Datum pg_ls_logicalsnapdir(PG_FUNCTION_ARGS)
Datum pg_ls_waldir(PG_FUNCTION_ARGS)
Datum pg_ls_replslotdir(PG_FUNCTION_ARGS)
Datum pg_ls_dir(PG_FUNCTION_ARGS)
static bytea * pg_read_binary_file_common(text *filename_t, int64 seek_offset, int64 bytes_to_read, bool read_to_eof, bool missing_ok)
Datum pg_ls_archive_statusdir(PG_FUNCTION_ARGS)
Datum pg_stat_file(PG_FUNCTION_ARGS)
static text * read_text_file(const char *filename, int64 seek_offset, int64 bytes_to_read, bool missing_ok)
static Datum pg_ls_tmpdir(FunctionCallInfo fcinfo, Oid tblspc)
static text * pg_read_file_common(text *filename_t, int64 seek_offset, int64 bytes_to_read, bool read_to_eof, bool missing_ok)
static bytea * read_binary_file(const char *filename, int64 seek_offset, int64 bytes_to_read, bool missing_ok)
Datum pg_read_binary_file_off_len(PG_FUNCTION_ARGS)
Datum pg_ls_dir_1arg(PG_FUNCTION_ARGS)
Datum pg_read_binary_file_off_len_missing(PG_FUNCTION_ARGS)
Datum pg_read_file_all(PG_FUNCTION_ARGS)
Datum pg_ls_tmpdir_noargs(PG_FUNCTION_ARGS)
Datum pg_ls_logdir(PG_FUNCTION_ARGS)
Datum pg_ls_logicalmapdir(PG_FUNCTION_ARGS)
Datum pg_stat_file_1arg(PG_FUNCTION_ARGS)
Datum pg_read_file_all_missing(PG_FUNCTION_ARGS)
Datum pg_ls_tmpdir_1arg(PG_FUNCTION_ARGS)
static Datum pg_ls_dir_files(FunctionCallInfo fcinfo, const char *dir, bool missing_ok)
static char * convert_and_check_filename(text *arg)
HeapTuple heap_form_tuple(TupleDesc tupleDescriptor, const Datum *values, const bool *isnull)
bool pg_verifymbstr(const char *mbstr, int len, bool noError)
void pfree(void *pointer)
static char buf[DEFAULT_XLOG_SEG_SIZE]
#define is_absolute_path(filename)
bool path_is_prefix_of_path(const char *path1, const char *path2)
bool path_is_relative_and_below_cwd(const char *path)
void canonicalize_path(char *path)
static Datum Int64GetDatum(int64 X)
static Datum BoolGetDatum(bool X)
static Datum ObjectIdGetDatum(Oid X)
#define PG_LOGICAL_SNAPSHOTS_DIR
#define PG_LOGICAL_MAPPINGS_DIR
ReplicationSlot * SearchNamedReplicationSlot(const char *name, bool need_lock)
void enlargeStringInfo(StringInfo str, int needed)
void initStringInfo(StringInfo str)
#define SearchSysCacheExists1(cacheId, key1)
TupleDesc CreateTemplateTupleDesc(int natts)
void TupleDescInitEntry(TupleDesc desc, AttrNumber attributeNumber, const char *attributeName, Oid oidtypeid, int32 typmod, int attdim)
void tuplestore_putvalues(Tuplestorestate *state, TupleDesc tdesc, const Datum *values, const bool *isnull)
static Datum TimestampTzGetDatum(TimestampTz X)
static Size VARSIZE(const void *PTR)
static char * VARDATA(const void *PTR)
static void SET_VARSIZE(void *PTR, Size len)
char * text_to_cstring(const text *t)
#define fseeko(stream, offset, origin)