171 Cost *startup_cost,
Cost *total_cost);
251 errhint(
"Perhaps you meant the option \"%s\".",
253 errhint(
"There are no valid options in this context.")));
266 errmsg(
"conflicting or redundant options")));
291 errmsg(
"permission denied to set the \"%s\" option of a file_fdw foreign table",
293 errdetail(
"Only roles with privileges of the \"%s\" role may set this option.",
294 "pg_read_server_files")));
300 errmsg(
"permission denied to set the \"%s\" option of a file_fdw foreign table",
302 errdetail(
"Only roles with privileges of the \"%s\" role may set this option.",
303 "pg_execute_server_program")));
317 errmsg(
"conflicting or redundant options"),
318 errhint(
"Option \"force_not_null\" supplied more than once for a column.")));
329 errmsg(
"conflicting or redundant options"),
330 errhint(
"Option \"force_null\" supplied more than once for a column.")));
350 errmsg(
"either filename or program is required for file_fdw foreign tables")));
436 elog(
ERROR,
"either filename or program is required for file_fdw foreign tables");
473 if (attr->attisdropped)
539 baserel->fdw_private = fdw_private;
569 (
Node *) columns, -1));
573 &startup_cost, &total_cost);
717 festate->is_program = is_program;
742 errcallback.
arg = cstate;
801 errmsg(
"skipped more than REJECT_LIMIT (%" PRId64 ") rows due to data type incompatibility",
855 festate->cstate->num_errors > 0 &&
859 "%" PRIu64 " rows were skipped due to data type incompatibility",
900 errmsg(
"could not stat file \"%s\": %m",
1012 if (attr->attisdropped)
1019 if (attr->attgenerated)
1083 fdw_private->
pages = pages;
1117 fdw_private->
ntuples = ntuples;
1144 Cost *startup_cost,
Cost *total_cost)
1147 double ntuples = fdw_private->
ntuples;
1164 *startup_cost =
baserel->baserestrictcost.startup;
1167 *total_cost = *startup_cost + run_cost;
1191 double rowstoskip = -1;
1210 nulls = (
bool *)
palloc(tupDesc->
natts *
sizeof(
bool));
1226 "file_fdw temporary context",
1234 errcallback.
arg = cstate;
1277 if (numrows < targrows)
1291 if (rowstoskip <= 0)
1299 Assert(k >= 0 && k < targrows);
1321 "%" PRIu64 " rows were skipped due to data type incompatibility",
1334 (
errmsg(
"\"%s\": file contains %.0f rows; "
1335 "%d rows in sample",
bool has_privs_of_role(Oid member, Oid role)
void ProcessCopyOptions(ParseState *pstate, CopyFormatOptions *opts_out, bool is_from, List *options)
int bms_next_member(const Bitmapset *a, int prevbit)
static Datum values[MAXATTR]
#define Assert(condition)
Selectivity clauselist_selectivity(PlannerInfo *root, List *clauses, int varRelid, JoinType jointype, SpecialJoinInfo *sjinfo)
CopyFromState BeginCopyFrom(ParseState *pstate, Relation rel, Node *whereClause, const char *filename, bool is_program, copy_data_source_cb data_source_cb, List *attnamelist, List *options)
void EndCopyFrom(CopyFromState cstate)
void CopyFromErrorCallback(void *arg)
bool NextCopyFrom(CopyFromState cstate, ExprContext *econtext, Datum *values, bool *nulls)
double clamp_row_est(double nrows)
ForeignScan * make_foreignscan(List *qptlist, List *qpqual, Index scanrelid, List *fdw_exprs, List *fdw_private, List *fdw_scan_tlist, List *fdw_recheck_quals, Plan *outer_plan)
char * defGetString(DefElem *def)
bool defGetBoolean(DefElem *def)
int errmsg_plural(const char *fmt_singular, const char *fmt_plural, unsigned long n,...)
int errcode_for_file_access(void)
int errdetail(const char *fmt,...)
ErrorContextCallback * error_context_stack
int errhint(const char *fmt,...)
int errcode(int sqlerrcode)
int errmsg(const char *fmt,...)
#define ereport(elevel,...)
TupleTableSlot * ExecStoreVirtualTuple(TupleTableSlot *slot)
EState * CreateExecutorState(void)
#define ResetPerTupleExprContext(estate)
#define GetPerTupleExprContext(estate)
#define GetPerTupleMemoryContext(estate)
#define EXEC_FLAG_EXPLAIN_ONLY
int(* AcquireSampleRowsFunc)(Relation relation, int elevel, HeapTuple *rows, int targrows, double *totalrows, double *totaldeadrows)
#define palloc_object(type)
static ForeignScan * fileGetForeignPlan(PlannerInfo *root, RelOptInfo *baserel, Oid foreigntableid, ForeignPath *best_path, List *tlist, List *scan_clauses, Plan *outer_plan)
static void fileEndForeignScan(ForeignScanState *node)
Datum file_fdw_handler(PG_FUNCTION_ARGS)
static bool check_selective_binary_conversion(RelOptInfo *baserel, Oid foreigntableid, List **columns)
static void fileGetForeignRelSize(PlannerInfo *root, RelOptInfo *baserel, Oid foreigntableid)
static void fileExplainForeignScan(ForeignScanState *node, ExplainState *es)
static List * get_file_fdw_attribute_options(Oid relid)
Datum file_fdw_validator(PG_FUNCTION_ARGS)
static void estimate_costs(PlannerInfo *root, RelOptInfo *baserel, FileFdwPlanState *fdw_private, Cost *startup_cost, Cost *total_cost)
static int file_acquire_sample_rows(Relation onerel, int elevel, HeapTuple *rows, int targrows, double *totalrows, double *totaldeadrows)
static const struct FileFdwOption valid_options[]
static bool fileAnalyzeForeignTable(Relation relation, AcquireSampleRowsFunc *func, BlockNumber *totalpages)
static void fileReScanForeignScan(ForeignScanState *node)
static bool is_valid_option(const char *option, Oid context)
static bool fileIsForeignScanParallelSafe(PlannerInfo *root, RelOptInfo *rel, RangeTblEntry *rte)
static void fileGetForeignPaths(PlannerInfo *root, RelOptInfo *baserel, Oid foreigntableid)
static void fileGetOptions(Oid foreigntableid, char **filename, bool *is_program, List **other_options)
static void estimate_size(PlannerInfo *root, RelOptInfo *baserel, FileFdwPlanState *fdw_private)
static void fileBeginForeignScan(ForeignScanState *node, int eflags)
static TupleTableSlot * fileIterateForeignScan(ForeignScanState *node)
#define PG_MODULE_MAGIC_EXT(...)
#define PG_GETARG_DATUM(n)
#define PG_FUNCTION_INFO_V1(funcname)
#define PG_RETURN_POINTER(x)
ForeignDataWrapper * GetForeignDataWrapper(Oid fdwid)
ForeignTable * GetForeignTable(Oid relid)
ForeignServer * GetForeignServer(Oid serverid)
List * GetForeignColumnOptions(Oid relid, AttrNumber attnum)
HeapTuple heap_form_tuple(TupleDesc tupleDescriptor, const Datum *values, const bool *isnull)
void heap_freetuple(HeapTuple htup)
#define SizeofHeapTupleHeader
@ COPY_LOG_VERBOSITY_DEFAULT
struct parser_state match_state[5]
List * lappend(List *list, void *datum)
List * list_concat(List *list1, const List *list2)
DefElem * makeDefElem(char *name, Node *arg, int location)
void MemoryContextReset(MemoryContext context)
char * pstrdup(const char *in)
void pfree(void *pointer)
MemoryContext CurrentMemoryContext
void MemoryContextDelete(MemoryContext context)
#define AllocSetContextCreate
#define ALLOCSET_DEFAULT_SIZES
#define CHECK_FOR_INTERRUPTS()
static MemoryContext MemoryContextSwitchTo(MemoryContext context)
ForeignPath * create_foreignscan_path(PlannerInfo *root, RelOptInfo *rel, PathTarget *target, double rows, int disabled_nodes, Cost startup_cost, Cost total_cost, List *pathkeys, Relids required_outer, Path *fdw_outerpath, List *fdw_restrictinfo, List *fdw_private)
void add_path(RelOptInfo *parent_rel, Path *new_path)
FormData_pg_attribute * Form_pg_attribute
static int list_length(const List *l)
#define foreach_delete_current(lst, var_or_cell)
static const struct lconv_member_info table[]
#define RelationGetRelid(relation)
#define RelationGetDescr(relation)
#define RelationGetRelationName(relation)
List * untransformRelOptions(Datum options)
List * extract_actual_clauses(List *restrictinfo_list, bool pseudoconstant)
void reservoir_init_selection_state(ReservoirState rs, int n)
double sampler_random_fract(pg_prng_state *randstate)
double reservoir_get_next_S(ReservoirState rs, double t, int n)
ErrorSaveContext * escontext
struct ErrorContextCallback * previous
void(* callback)(void *arg)
ReScanForeignScan_function ReScanForeignScan
BeginForeignScan_function BeginForeignScan
IsForeignScanParallelSafe_function IsForeignScanParallelSafe
GetForeignPaths_function GetForeignPaths
GetForeignRelSize_function GetForeignRelSize
ExplainForeignScan_function ExplainForeignScan
EndForeignScan_function EndForeignScan
AnalyzeForeignTable_function AnalyzeForeignTable
IterateForeignScan_function IterateForeignScan
GetForeignPlan_function GetForeignPlan
Relation ss_currentRelation
TupleTableSlot * ss_ScanTupleSlot
#define FirstLowInvalidHeapAttributeNumber
void table_close(Relation relation, LOCKMODE lockmode)
Relation table_open(Oid relationId, LOCKMODE lockmode)
static FormData_pg_attribute * TupleDescAttr(TupleDesc tupdesc, int i)
static CompactAttribute * TupleDescCompactAttr(TupleDesc tupdesc, int i)
static TupleTableSlot * ExecClearTuple(TupleTableSlot *slot)
void vacuum_delay_point(bool is_analyze)
String * makeString(char *str)
void pull_varattnos(Node *node, Index varno, Bitmapset **varattnos)
const char * getClosestMatch(ClosestMatchState *state)
void initClosestMatch(ClosestMatchState *state, const char *source, int max_d)
void updateClosestMatch(ClosestMatchState *state, const char *candidate)