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/copyfrom_internal.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 933 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 1139 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 1058 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 1183 of file file_fdw.c.
References ALLOCSET_DEFAULT_SIZES, AllocSetContextCreate, ErrorContextCallback::arg, Assert, BeginCopyFrom(), ErrorContextCallback::callback, COPY_LOG_VERBOSITY_DEFAULT, COPY_ON_ERROR_IGNORE, CopyFromErrorCallback(), CurrentMemoryContext, EndCopyFrom(), ereport, errmsg(), errmsg_plural(), error_context_stack, ErrorSaveContext::error_occurred, CopyFromStateData::escontext, fileGetOptions(), filename, heap_form_tuple(), heap_freetuple(), CopyFormatOptions::log_verbosity, MemoryContextDelete(), MemoryContextReset(), MemoryContextSwitchTo(), TupleDescData::natts, NextCopyFrom(), NIL, NOTICE, CopyFromStateData::num_errors, CopyFormatOptions::on_error, options, CopyFromStateData::opts, 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 177 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 202 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 866 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 671 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 841 of file file_fdw.c.
References COPY_LOG_VERBOSITY_DEFAULT, COPY_ON_ERROR_IGNORE, FileFdwExecutionState::cstate, EndCopyFrom(), ereport, errmsg_plural(), ForeignScanState::fdw_state, if(), CopyFormatOptions::log_verbosity, NOTICE, CopyFromStateData::num_errors, CopyFormatOptions::on_error, and CopyFromStateData::opts.
Referenced by file_fdw_handler().
|
static |
Definition at line 639 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 549 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 604 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 518 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 374 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 917 of file file_fdw.c.
Referenced by file_fdw_handler().
|
static |
Definition at line 725 of file file_fdw.c.
References ErrorContextCallback::arg, ErrorContextCallback::callback, CHECK_FOR_INTERRUPTS, COPY_ON_ERROR_IGNORE, CopyFromErrorCallback(), CreateExecutorState(), FileFdwExecutionState::cstate, CurrentMemoryContext, ereport, errcode(), errmsg(), ERROR, error_context_stack, ErrorSaveContext::error_occurred, CopyFromStateData::escontext, ExecClearTuple(), ExecStoreVirtualTuple(), ForeignScanState::fdw_state, GetPerTupleExprContext, GetPerTupleMemoryContext, MemoryContextSwitchTo(), NextCopyFrom(), CopyFromStateData::num_errors, CopyFormatOptions::on_error, CopyFromStateData::opts, ErrorContextCallback::previous, CopyFormatOptions::reject_limit, ResetPerTupleExprContext, ForeignScanState::ss, ScanState::ss_ScanTupleSlot, TupleTableSlot::tts_isnull, and TupleTableSlot::tts_values.
Referenced by file_fdw_handler().
|
static |
Definition at line 820 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 445 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().
|
static |
Definition at line 355 of file file_fdw.c.
References 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 43 of file file_fdw.c.
|
static |
Definition at line 63 of file file_fdw.c.
Referenced by file_fdw_validator(), and is_valid_option().