PostgreSQL Source Code
git master
|
#include "postgres.h"
#include <sys/stat.h>
#include <unistd.h>
#include "access/htup_details.h"
#include "access/reloptions.h"
#include "access/sysattr.h"
#include "access/table.h"
#include "catalog/pg_authid.h"
#include "catalog/pg_foreign_table.h"
#include "commands/copy.h"
#include "commands/defrem.h"
#include "commands/explain.h"
#include "commands/vacuum.h"
#include "foreign/fdwapi.h"
#include "foreign/foreign.h"
#include "miscadmin.h"
#include "nodes/makefuncs.h"
#include "optimizer/optimizer.h"
#include "optimizer/pathnode.h"
#include "optimizer/planmain.h"
#include "optimizer/restrictinfo.h"
#include "utils/acl.h"
#include "utils/memutils.h"
#include "utils/rel.h"
#include "utils/sampling.h"
#include "utils/varlena.h"
Go to the source code of this file.
Data Structures | |
struct | FileFdwOption |
struct | FileFdwPlanState |
struct | FileFdwExecutionState |
Typedefs | |
typedef struct FileFdwPlanState | FileFdwPlanState |
typedef struct FileFdwExecutionState | FileFdwExecutionState |
Variables | |
PG_MODULE_MAGIC | |
static const struct FileFdwOption | valid_options [] |
typedef struct FileFdwExecutionState FileFdwExecutionState |
typedef struct FileFdwPlanState FileFdwPlanState |
|
static |
Definition at line 875 of file file_fdw.c.
References AccessShareLock, attname, attnum, RelOptInfo::baserestrictinfo, bms_next_member(), RestrictInfo::clause, defGetString(), DefElem::defname, PathTarget::exprs, FirstLowInvalidHeapAttributeNumber, format, GetForeignTable(), i, lappend(), lfirst, list_length(), makeString(), NameStr, TupleDescData::natts, NIL, ForeignTable::options, pstrdup(), pull_varattnos(), RelationGetDescr, RelOptInfo::relid, RelOptInfo::reltarget, table_close(), table_open(), and TupleDescAttr.
Referenced by fileGetForeignPaths().
|
static |
Definition at line 1081 of file file_fdw.c.
References RelOptInfo::baserestrictcost, cpu_tuple_cost, FileFdwPlanState::ntuples, FileFdwPlanState::pages, QualCost::per_tuple, seq_page_cost, and QualCost::startup.
Referenced by fileGetForeignPaths().
|
static |
Definition at line 1000 of file file_fdw.c.
References RelOptInfo::baserestrictinfo, clamp_row_est(), clauselist_selectivity(), FileFdwPlanState::filename, FileFdwPlanState::is_program, JOIN_INNER, MAXALIGN, FileFdwPlanState::ntuples, FileFdwPlanState::pages, RelOptInfo::pages, RelOptInfo::reltarget, root, RelOptInfo::rows, SizeofHeapTupleHeader, stat::st_size, RelOptInfo::tuples, and PathTarget::width.
Referenced by fileGetForeignRelSize().
|
static |
Definition at line 1124 of file file_fdw.c.
References ALLOCSET_DEFAULT_SIZES, AllocSetContextCreate, ErrorContextCallback::arg, Assert, BeginCopyFrom(), ErrorContextCallback::callback, CopyFromErrorCallback(), CurrentMemoryContext, EndCopyFrom(), ereport, errmsg(), error_context_stack, fileGetOptions(), filename, heap_form_tuple(), heap_freetuple(), MemoryContextDelete(), MemoryContextReset(), MemoryContextSwitchTo(), TupleDescData::natts, NextCopyFrom(), NIL, options, palloc(), pfree(), ErrorContextCallback::previous, ReservoirStateData::randstate, RelationGetDescr, RelationGetRelationName, RelationGetRelid, reservoir_get_next_S(), reservoir_init_selection_state(), sampler_random_fract(), vacuum_delay_point(), and values.
Referenced by fileAnalyzeForeignTable().
Datum file_fdw_handler | ( | PG_FUNCTION_ARGS | ) |
Definition at line 173 of file file_fdw.c.
References FdwRoutine::AnalyzeForeignTable, FdwRoutine::BeginForeignScan, FdwRoutine::EndForeignScan, FdwRoutine::ExplainForeignScan, fileAnalyzeForeignTable(), fileBeginForeignScan(), fileEndForeignScan(), fileExplainForeignScan(), fileGetForeignPaths(), fileGetForeignPlan(), fileGetForeignRelSize(), fileIsForeignScanParallelSafe(), fileIterateForeignScan(), fileReScanForeignScan(), FdwRoutine::GetForeignPaths, FdwRoutine::GetForeignPlan, FdwRoutine::GetForeignRelSize, FdwRoutine::IsForeignScanParallelSafe, FdwRoutine::IterateForeignScan, makeNode, PG_RETURN_POINTER, and FdwRoutine::ReScanForeignScan.
Datum file_fdw_validator | ( | PG_FUNCTION_ARGS | ) |
Definition at line 198 of file file_fdw.c.
References defGetBoolean(), defGetString(), DefElem::defname, ereport, errcode(), errdetail(), errhint(), errmsg(), ERROR, filename, getClosestMatch(), GetUserId(), has_privs_of_role(), initClosestMatch(), is_valid_option(), lappend(), lfirst, match_state, NIL, FileFdwOption::optcontext, FileFdwOption::optname, PG_GETARG_DATUM, PG_GETARG_OID, PG_RETURN_VOID, ProcessCopyOptions(), untransformRelOptions(), updateClosestMatch(), and valid_options.
|
static |
Definition at line 808 of file file_fdw.c.
References ereport, errcode_for_file_access(), errmsg(), ERROR, file_acquire_sample_rows(), fileGetOptions(), filename, options, RelationGetRelid, stat::st_size, and stat.
Referenced by file_fdw_handler().
|
static |
Definition at line 667 of file file_fdw.c.
References BeginCopyFrom(), EXEC_FLAG_EXPLAIN_ONLY, ForeignScanState::fdw_state, fileGetOptions(), filename, if(), list_concat(), NIL, options, palloc(), PlanState::plan, plan, ScanState::ps, RelationGetRelid, ForeignScanState::ss, and ScanState::ss_currentRelation.
Referenced by file_fdw_handler().
|
static |
Definition at line 794 of file file_fdw.c.
References FileFdwExecutionState::cstate, EndCopyFrom(), ForeignScanState::fdw_state, and if().
Referenced by file_fdw_handler().
|
static |
Definition at line 635 of file file_fdw.c.
References ExplainState::costs, ExplainPropertyInteger(), ExplainPropertyText(), fileGetOptions(), filename, options, RelationGetRelid, ForeignScanState::ss, ScanState::ss_currentRelation, stat::st_size, and stat.
Referenced by file_fdw_handler().
|
static |
Definition at line 545 of file file_fdw.c.
References add_path(), check_selective_binary_conversion(), create_foreignscan_path(), estimate_costs(), if(), RelOptInfo::lateral_relids, list_make1, makeDefElem(), NIL, root, and RelOptInfo::rows.
Referenced by file_fdw_handler().
|
static |
Definition at line 600 of file file_fdw.c.
References extract_actual_clauses(), ForeignPath::fdw_private, make_foreignscan(), NIL, and RelOptInfo::relid.
Referenced by file_fdw_handler().
|
static |
Definition at line 514 of file file_fdw.c.
References estimate_size(), fileGetOptions(), FileFdwPlanState::filename, FileFdwPlanState::is_program, FileFdwPlanState::options, palloc(), and root.
Referenced by file_fdw_handler().
|
static |
Definition at line 370 of file file_fdw.c.
References defGetString(), DefElem::defname, elog, ERROR, ForeignServer::fdwid, filename, foreach_delete_current, get_file_fdw_attribute_options(), GetForeignDataWrapper(), GetForeignServer(), GetForeignTable(), lfirst, list_concat(), NIL, options, ForeignDataWrapper::options, ForeignServer::options, ForeignTable::options, and ForeignTable::serverid.
Referenced by file_acquire_sample_rows(), fileAnalyzeForeignTable(), fileBeginForeignScan(), fileExplainForeignScan(), and fileGetForeignRelSize().
|
static |
Definition at line 859 of file file_fdw.c.
Referenced by file_fdw_handler().
|
static |
Definition at line 721 of file file_fdw.c.
References ErrorContextCallback::arg, ErrorContextCallback::callback, CopyFromErrorCallback(), CreateExecutorState(), FileFdwExecutionState::cstate, error_context_stack, ExecClearTuple(), ExecStoreVirtualTuple(), ForeignScanState::fdw_state, GetPerTupleExprContext, GetPerTupleMemoryContext, MemoryContextSwitchTo(), NextCopyFrom(), ErrorContextCallback::previous, ForeignScanState::ss, ScanState::ss_ScanTupleSlot, TupleTableSlot::tts_isnull, and TupleTableSlot::tts_values.
Referenced by file_fdw_handler().
|
static |
Definition at line 773 of file file_fdw.c.
References BeginCopyFrom(), FileFdwExecutionState::cstate, EndCopyFrom(), ForeignScanState::fdw_state, FileFdwExecutionState::filename, FileFdwExecutionState::is_program, NIL, FileFdwExecutionState::options, ForeignScanState::ss, and ScanState::ss_currentRelation.
Referenced by file_fdw_handler().
Definition at line 441 of file file_fdw.c.
References AccessShareLock, attname, attnum, defGetBoolean(), DefElem::defname, GetForeignColumnOptions(), lappend(), lfirst, makeDefElem(), makeString(), NameStr, TupleDescData::natts, NIL, options, pstrdup(), RelationGetDescr, table_close(), table_open(), and TupleDescAttr.
Referenced by fileGetOptions().
Definition at line 351 of file file_fdw.c.
References context, FileFdwOption::optcontext, FileFdwOption::optname, and valid_options.
Referenced by file_fdw_validator().
PG_FUNCTION_INFO_V1 | ( | file_fdw_handler | ) |
PG_FUNCTION_INFO_V1 | ( | file_fdw_validator | ) |
PG_MODULE_MAGIC |
Definition at line 42 of file file_fdw.c.
|
static |
Definition at line 42 of file file_fdw.c.
Referenced by file_fdw_validator(), and is_valid_option().