PostgreSQL Source Code git master
|
#include "postgres.h"
#include <limits.h>
#include "access/htup_details.h"
#include "access/sysattr.h"
#include "access/table.h"
#include "catalog/pg_opfamily.h"
#include "commands/defrem.h"
#include "commands/explain_format.h"
#include "commands/explain_state.h"
#include "executor/execAsync.h"
#include "foreign/fdwapi.h"
#include "funcapi.h"
#include "miscadmin.h"
#include "nodes/makefuncs.h"
#include "nodes/nodeFuncs.h"
#include "optimizer/appendinfo.h"
#include "optimizer/cost.h"
#include "optimizer/inherit.h"
#include "optimizer/optimizer.h"
#include "optimizer/pathnode.h"
#include "optimizer/paths.h"
#include "optimizer/planmain.h"
#include "optimizer/prep.h"
#include "optimizer/restrictinfo.h"
#include "optimizer/tlist.h"
#include "parser/parsetree.h"
#include "postgres_fdw.h"
#include "storage/latch.h"
#include "utils/builtins.h"
#include "utils/float.h"
#include "utils/guc.h"
#include "utils/lsyscache.h"
#include "utils/memutils.h"
#include "utils/rel.h"
#include "utils/sampling.h"
#include "utils/selfuncs.h"
Go to the source code of this file.
Data Structures | |
struct | PgFdwScanState |
struct | PgFdwModifyState |
struct | PgFdwDirectModifyState |
struct | PgFdwAnalyzeState |
struct | PgFdwPathExtraData |
struct | ConversionLocation |
struct | ec_member_foreign_arg |
Macros | |
#define | DEFAULT_FDW_STARTUP_COST 100.0 |
#define | DEFAULT_FDW_TUPLE_COST 0.2 |
#define | DEFAULT_FDW_SORT_MULTIPLIER 1.2 |
Typedefs | |
typedef struct PgFdwScanState | PgFdwScanState |
typedef struct PgFdwModifyState | PgFdwModifyState |
typedef struct PgFdwDirectModifyState | PgFdwDirectModifyState |
typedef struct PgFdwAnalyzeState | PgFdwAnalyzeState |
typedef struct ConversionLocation | ConversionLocation |
Variables | |
PG_MODULE_MAGIC | |
#define DEFAULT_FDW_SORT_MULTIPLIER 1.2 |
Definition at line 61 of file postgres_fdw.c.
#define DEFAULT_FDW_STARTUP_COST 100.0 |
Definition at line 55 of file postgres_fdw.c.
#define DEFAULT_FDW_TUPLE_COST 0.2 |
Definition at line 58 of file postgres_fdw.c.
typedef struct ConversionLocation ConversionLocation |
typedef struct PgFdwAnalyzeState PgFdwAnalyzeState |
typedef struct PgFdwDirectModifyState PgFdwDirectModifyState |
typedef struct PgFdwModifyState PgFdwModifyState |
typedef struct PgFdwScanState PgFdwScanState |
Enumerator | |
---|---|
FdwDirectModifyPrivateUpdateSql | |
FdwDirectModifyPrivateHasReturning | |
FdwDirectModifyPrivateRetrievedAttrs | |
FdwDirectModifyPrivateSetProcessed |
Definition at line 121 of file postgres_fdw.c.
Enumerator | |
---|---|
FdwModifyPrivateUpdateSql | |
FdwModifyPrivateTargetAttnums | |
FdwModifyPrivateLen | |
FdwModifyPrivateHasReturning | |
FdwModifyPrivateRetrievedAttrs |
Definition at line 98 of file postgres_fdw.c.
enum FdwPathPrivateIndex |
Enumerator | |
---|---|
FdwPathPrivateHasFinalSort | |
FdwPathPrivateHasLimit |
Definition at line 281 of file postgres_fdw.c.
enum FdwScanPrivateIndex |
Enumerator | |
---|---|
FdwScanPrivateSelectSql | |
FdwScanPrivateRetrievedAttrs | |
FdwScanPrivateFetchSize | |
FdwScanPrivateRelations |
Definition at line 70 of file postgres_fdw.c.
|
static |
Definition at line 7013 of file postgres_fdw.c.
References add_path(), Assert(), CMD_SELECT, PgFdwPathExtraData::count_est, FinalPathExtraData::count_est, create_foreign_upper_path(), Path::disabled_nodes, estimate_path_cost_size(), PgFdwPathExtraData::has_final_sort, PgFdwPathExtraData::has_limit, is_foreign_expr(), IsA, lfirst, FinalPathExtraData::limit_needed, LIMIT_OPTION_WITH_TIES, PgFdwPathExtraData::limit_tuples, FinalPathExtraData::limit_tuples, list_make2, PgFdwRelationInfo::local_conds, makeBoolean(), merge_fdw_options(), NIL, PgFdwPathExtraData::offset_est, FinalPathExtraData::offset_est, PgFdwRelationInfo::outerrel, palloc0(), parse(), Path::pathkeys, RelOptInfo::pathlist, RELOPT_BASEREL, RELOPT_JOINREL, RELOPT_UPPER_REL, RelOptInfo::reloptkind, root, Path::rows, PgFdwRelationInfo::server, PgFdwRelationInfo::stage, Path::startup_cost, subpath(), PgFdwRelationInfo::table, PgFdwPathExtraData::target, Path::total_cost, UPPERREL_FINAL, UPPERREL_GROUP_AGG, UPPERREL_ORDERED, PgFdwRelationInfo::use_remote_estimate, and PgFdwRelationInfo::user.
Referenced by postgresGetForeignUpperPaths().
|
static |
Definition at line 6779 of file postgres_fdw.c.
References add_path(), Assert(), clauselist_selectivity(), cost_qual_eval(), create_foreign_upper_path(), PgFdwRelationInfo::disabled_nodes, estimate_path_cost_size(), foreign_grouping_ok(), GroupPathExtraData::havingQual, JOIN_INNER, PgFdwRelationInfo::local_conds, PgFdwRelationInfo::local_conds_cost, PgFdwRelationInfo::local_conds_sel, merge_fdw_options(), NIL, PgFdwRelationInfo::outerrel, parse(), PARTITIONWISE_AGGREGATE_FULL, PARTITIONWISE_AGGREGATE_NONE, GroupPathExtraData::patype, RelOptInfo::reltarget, root, PgFdwRelationInfo::rows, PgFdwRelationInfo::server, PgFdwRelationInfo::startup_cost, PgFdwRelationInfo::table, PgFdwRelationInfo::total_cost, PgFdwRelationInfo::user, and PgFdwRelationInfo::width.
Referenced by postgresGetForeignUpperPaths().
|
static |
Definition at line 6875 of file postgres_fdw.c.
References add_path(), Assert(), create_foreign_upper_path(), EquivalenceClass::ec_has_volatile, estimate_path_cost_size(), find_em_for_rel_target(), PgFdwPathExtraData::has_final_sort, is_shippable(), lfirst, list_make2, makeBoolean(), merge_fdw_options(), NIL, PgFdwRelationInfo::outerrel, palloc0(), parse(), PathKey::pk_opfamily, PgFdwRelationInfo::pushdown_safe, PgFdwRelationInfo::qp_is_pushdown_safe, RELOPT_BASEREL, RELOPT_JOINREL, RELOPT_UPPER_REL, RelOptInfo::reloptkind, root, PgFdwRelationInfo::server, PgFdwRelationInfo::stage, PgFdwRelationInfo::table, PgFdwPathExtraData::target, UPPERREL_GROUP_AGG, UPPERREL_ORDERED, and PgFdwRelationInfo::user.
Referenced by postgresGetForeignUpperPaths().
|
static |
Definition at line 6098 of file postgres_fdw.c.
References add_new_columns_to_pathtarget(), add_path(), Assert(), RestrictInfo::clause, copy_pathtarget(), create_foreign_join_path(), create_foreignscan_path(), create_projection_path(), create_sort_path(), estimate_path_cost_size(), get_useful_pathkeys_for_relation(), is_projection_capable_path(), IS_SIMPLE_REL, RelOptInfo::lateral_relids, lfirst, lfirst_node, list_length(), PgFdwRelationInfo::local_conds, NIL, Path::pathkeys, pathkeys_contained_in(), pull_var_clause(), PVC_RECURSE_PLACEHOLDERS, and root.
Referenced by postgresGetForeignJoinPaths(), and postgresGetForeignPaths().
|
static |
Definition at line 3643 of file postgres_fdw.c.
References cost_sort(), DEFAULT_FDW_SORT_MULTIPLIER, grouping_is_sortable(), pathkeys_contained_in(), root, Path::startup_cost, Path::total_cost, and work_mem.
Referenced by estimate_path_cost_size().
|
static |
Definition at line 5388 of file postgres_fdw.c.
References PgFdwAnalyzeState::anl_cxt, Assert(), PgFdwAnalyzeState::attinmeta, heap_freetuple(), make_tuple_from_result_row(), MemoryContextSwitchTo(), PgFdwAnalyzeState::numrows, ReservoirStateData::randstate, PgFdwAnalyzeState::rel, reservoir_get_next_S(), PgFdwAnalyzeState::retrieved_attrs, PgFdwAnalyzeState::rows, PgFdwAnalyzeState::rowstoskip, PgFdwAnalyzeState::rstate, sampler_random_fract(), PgFdwAnalyzeState::samplerows, PgFdwAnalyzeState::targrows, and PgFdwAnalyzeState::temp_cxt.
Referenced by postgresAcquireSampleRowsFunc().
|
static |
Definition at line 4757 of file postgres_fdw.c.
References PgFdwDirectModifyState::attnoMap, PgFdwDirectModifyState::ctidAttno, DatumGetPointer(), ExecClearTuple(), ExecFetchSlotHeapTuple(), ExecGetReturningSlot(), ExecStoreVirtualTuple(), PgFdwDirectModifyState::hasSystemCols, HeapTupleHeaderSetCmin(), HeapTupleHeaderSetXmax(), HeapTupleHeaderSetXmin(), i, InvalidTransactionId, j, TupleDescData::natts, RelationGetDescr, PgFdwDirectModifyState::resultRel, slot_getallattrs(), HeapTupleData::t_data, HeapTupleData::t_self, TupleTableSlot::tts_isnull, TupleTableSlot::tts_values, and values.
Referenced by get_returning_data().
|
static |
Definition at line 6221 of file postgres_fdw.c.
References PgFdwRelationInfo::async_capable, defGetBoolean(), defGetString(), DefElem::defname, ExtractExtensionList(), PgFdwRelationInfo::fdw_startup_cost, PgFdwRelationInfo::fdw_tuple_cost, PgFdwRelationInfo::fetch_size, lfirst, ForeignServer::options, parse_int(), parse_real(), PgFdwRelationInfo::server, PgFdwRelationInfo::shippable_extensions, and PgFdwRelationInfo::use_remote_estimate.
Referenced by postgresGetForeignRelSize().
|
static |
Definition at line 6253 of file postgres_fdw.c.
References PgFdwRelationInfo::async_capable, defGetBoolean(), defGetString(), DefElem::defname, PgFdwRelationInfo::fetch_size, lfirst, ForeignTable::options, parse_int(), PgFdwRelationInfo::table, and PgFdwRelationInfo::use_remote_estimate.
Referenced by postgresGetForeignRelSize().
Definition at line 4430 of file postgres_fdw.c.
References Assert(), i, InvalidAttrNumber, IsA, lappend(), lfirst, list_free(), list_length(), makeTargetEntry(), makeVar(), TupleDescData::natts, NIL, pull_var_clause(), PVC_INCLUDE_PLACEHOLDERS, RelationGetDescr, SelfItemPointerAttributeNumber, tlist_member(), TupleDescAttr(), Var::varattno, and Var::varno.
Referenced by postgresPlanDirectModify().
|
static |
Definition at line 3952 of file postgres_fdw.c.
References conn, cursor_number, ERROR, pgfdw_exec_query(), pgfdw_report_error(), PGRES_COMMAND_OK, PQclear(), PQresultStatus(), and snprintf.
Referenced by postgresAcquireSampleRowsFunc(), and postgresEndForeignScan().
|
static |
Definition at line 7535 of file postgres_fdw.c.
References Assert(), AsyncRequest::callback_pending, ExecAsyncResponse(), PlanState::instrument, InstrUpdateTupleCount(), produce_tuple_asynchronously(), AsyncRequest::requestee, AsyncRequest::result, and TupIsNull.
Referenced by postgresForeignAsyncConfigureWait().
|
static |
Definition at line 7726 of file postgres_fdw.c.
References arg, attname, castNode, ConversionLocation::cur_attno, errcontext, exec_rt_fetch(), TargetEntry::expr, ForeignScan::fdw_scan_tlist, ConversionLocation::fsstate, IsA, list_length(), list_nth(), list_nth_node, NameStr, TupleDescData::natts, PlanState::plan, ScanState::ps, ConversionLocation::rel, RelationGetDescr, RelationGetRelationName, relname, ForeignScan::scan, Scan::scanrelid, SelfItemPointerAttributeNumber, ForeignScanState::ss, PlanState::state, strVal, TupleDescAttr(), Var::varattno, and Var::varno.
Referenced by make_tuple_from_result_row().
|
static |
Definition at line 4271 of file postgres_fdw.c.
References Assert(), CompactAttribute::attgenerated, attnum, i, j, lfirst_int, MemoryContextSwitchTo(), NIL, OutputFunctionCall(), PgFdwModifyState::p_flinfo, PgFdwModifyState::p_nums, palloc(), PointerGetDatum(), PgFdwModifyState::rel, RelationGetDescr, reset_transmission_modes(), set_transmission_modes(), slot_getattr(), PgFdwModifyState::target_attrs, PgFdwModifyState::temp_cxt, TupleDescCompactAttr(), and value.
Referenced by execute_foreign_modify().
|
static |
Definition at line 3728 of file postgres_fdw.c.
References appendStringInfo(), buf, PgFdwScanState::conn, conn, PgFdwScanState::conn_state, PgFdwScanState::cursor_exists, PgFdwScanState::cursor_number, PgFdwScanState::eof_reached, ERROR, ForeignScanState::fdw_state, PgFdwScanState::fetch_ct_2, if(), initStringInfo(), MemoryContextSwitchTo(), PgFdwScanState::next_tuple, PgFdwScanState::num_tuples, PgFdwScanState::numParams, PgFdwScanState::param_exprs, PgFdwScanState::param_flinfo, PgFdwScanState::param_values, PgFdwConnState::pendingAreq, pfree(), pgfdw_get_result(), pgfdw_report_error(), PGRES_COMMAND_OK, PQclear(), PQresultStatus(), PQsendQueryParams(), process_pending_request(), process_query_params(), ScanState::ps, PlanState::ps_ExprContext, PgFdwScanState::query, ForeignScanState::ss, PgFdwScanState::tuples, and values.
Referenced by fetch_more_data_begin(), and postgresIterateForeignScan().
|
static |
Definition at line 3976 of file postgres_fdw.c.
References ALLOCSET_SMALL_SIZES, AllocSetContextCreate, Assert(), PgFdwModifyState::attinmeta, attnum, AttributeNumberIsValid, PgFdwModifyState::aux_fmstate, PgFdwModifyState::batch_size, CMD_DELETE, CMD_INSERT, CMD_UPDATE, PgFdwModifyState::conn, PgFdwModifyState::conn_state, PgFdwModifyState::ctidAttno, elog, ERROR, EState::es_query_cxt, ExecFindJunkAttributeInTlist(), ExecGetResultRelCheckAsUser(), fmgr_info(), get_batch_size_option(), GetConnection(), GetForeignTable(), getTypeOutputInfo(), GetUserMapping(), PgFdwModifyState::has_returning, lfirst_int, list_length(), PgFdwModifyState::num_slots, PgFdwModifyState::orig_query, PgFdwModifyState::p_flinfo, PgFdwModifyState::p_name, PgFdwModifyState::p_nums, palloc0(), pstrdup(), PgFdwModifyState::query, PgFdwModifyState::rel, RelationGetDescr, RelationGetRelid, PgFdwModifyState::retrieved_attrs, ResultRelInfo::ri_RelationDesc, ForeignTable::serverid, PgFdwModifyState::target_attrs, Plan::targetlist, PgFdwModifyState::temp_cxt, TupleDescAttr(), TupleDescGetAttInMetadata(), user, and PgFdwModifyState::values_end.
Referenced by postgresBeginForeignInsert(), and postgresBeginForeignModify().
|
static |
Definition at line 4401 of file postgres_fdw.c.
References PgFdwModifyState::conn, PgFdwModifyState::conn_state, ERROR, PgFdwModifyState::p_name, pfree(), pgfdw_exec_query(), pgfdw_report_error(), PGRES_COMMAND_OK, PQclear(), PQresultStatus(), and snprintf.
Referenced by execute_foreign_modify(), and finish_foreign_modify().
|
static |
Definition at line 3699 of file postgres_fdw.c.
References arg, EquivalenceMember::em_expr, equal(), and list_member().
Referenced by postgresGetForeignPaths().
|
static |
Definition at line 3090 of file postgres_fdw.c.
References adjust_foreign_grouping_path_cost(), adjust_limit_rows_costs(), AGGSPLIT_SIMPLE, appendStringInfoString(), Assert(), RelOptInfo::baserestrictcost, build_tlist_to_deparse(), clamp_row_est(), classifyConditions(), clauselist_selectivity(), conn, PathTarget::cost, cost_qual_eval(), PgFdwPathExtraData::count_est, cpu_operator_cost, cpu_tuple_cost, StringInfoData::data, DEFAULT_FDW_SORT_MULTIPLIER, deparseSelectStmtForRel(), estimate_num_groups(), PgFdwRelationInfo::fdw_startup_cost, PgFdwRelationInfo::fdw_tuple_cost, AggClauseCosts::finalCost, get_agg_clause_costs(), get_remote_estimate(), get_sortgrouplist_exprs(), GetConnection(), PgFdwRelationInfo::grouped_tlist, PgFdwPathExtraData::has_final_sort, PgFdwPathExtraData::has_limit, if(), initStringInfo(), PgFdwRelationInfo::innerrel, IS_JOIN_REL, IS_UPPER_REL, JOIN_INNER, PgFdwRelationInfo::joinclause_sel, PgFdwRelationInfo::joinclauses, PgFdwPathExtraData::limit_tuples, list_concat(), list_length(), PgFdwRelationInfo::local_conds_cost, PgFdwRelationInfo::local_conds_sel, Min, NIL, PgFdwPathExtraData::offset_est, PgFdwRelationInfo::outerrel, RelOptInfo::pages, QualCost::per_tuple, PgFdwRelationInfo::rel_startup_cost, PgFdwRelationInfo::rel_total_cost, ReleaseConnection(), RelOptInfo::relid, RELOPT_BASEREL, RELOPT_JOINREL, RELOPT_UPPER_REL, RelOptInfo::reloptkind, RelOptInfo::reltarget, PgFdwRelationInfo::remote_conds, PgFdwRelationInfo::retrieved_rows, root, PgFdwRelationInfo::rows, RelOptInfo::rows, seq_page_cost, PgFdwRelationInfo::stage, QualCost::startup, PgFdwPathExtraData::target, AggClauseCosts::transCost, RelOptInfo::tuples, UPPERREL_GROUP_AGG, PgFdwRelationInfo::use_remote_estimate, PgFdwRelationInfo::user, PgFdwRelationInfo::width, and PathTarget::width.
Referenced by add_foreign_final_paths(), add_foreign_grouping_paths(), add_foreign_ordered_paths(), add_paths_with_pathkeys_for_rel(), postgresGetForeignJoinPaths(), postgresGetForeignPaths(), and postgresGetForeignRelSize().
|
static |
Definition at line 4557 of file postgres_fdw.c.
References PgFdwDirectModifyState::conn, PgFdwDirectModifyState::conn_state, ERROR, ForeignScanState::fdw_state, PgFdwDirectModifyState::has_returning, if(), PgFdwDirectModifyState::num_tuples, PgFdwDirectModifyState::numParams, PgFdwDirectModifyState::param_exprs, PgFdwDirectModifyState::param_flinfo, PgFdwDirectModifyState::param_values, PgFdwConnState::pendingAreq, pgfdw_get_result(), pgfdw_report_error(), PGRES_COMMAND_OK, PGRES_TUPLES_OK, PQcmdTuples(), PQntuples(), PQresultStatus(), PQsendQueryParams(), process_pending_request(), process_query_params(), ScanState::ps, PlanState::ps_ExprContext, PgFdwDirectModifyState::query, PgFdwDirectModifyState::result, ForeignScanState::ss, and values.
Referenced by postgresIterateDirectModify().
|
static |
Definition at line 4096 of file postgres_fdw.c.
References Assert(), CMD_DELETE, CMD_INSERT, CMD_UPDATE, PgFdwModifyState::conn, PgFdwModifyState::conn_state, convert_prep_stmt_params(), PgFdwModifyState::ctidAttno, DatumGetPointer(), deallocate_query(), elog, ERROR, ExecGetJunkAttribute(), PgFdwModifyState::has_returning, initStringInfo(), MemoryContextReset(), PgFdwModifyState::num_slots, PgFdwModifyState::orig_query, PgFdwModifyState::p_name, PgFdwModifyState::p_nums, PgFdwConnState::pendingAreq, pfree(), pgfdw_get_result(), pgfdw_report_error(), PGRES_COMMAND_OK, PGRES_TUPLES_OK, PQclear(), PQcmdTuples(), PQntuples(), PQresultStatus(), PQsendQueryPrepared(), prepare_foreign_modify(), process_pending_request(), PgFdwModifyState::query, rebuildInsertSql(), PgFdwModifyState::rel, ResultRelInfo::ri_FdwState, store_returning_result(), PgFdwModifyState::target_attrs, PgFdwModifyState::temp_cxt, and PgFdwModifyState::values_end.
Referenced by postgresExecForeignBatchInsert(), postgresExecForeignDelete(), postgresExecForeignInsert(), and postgresExecForeignUpdate().
|
static |
Definition at line 3804 of file postgres_fdw.c.
References Assert(), PgFdwScanState::async_capable, PgFdwScanState::attinmeta, PgFdwScanState::batch_cxt, PgFdwScanState::conn, conn, PgFdwScanState::conn_state, PgFdwScanState::cursor_number, PgFdwScanState::eof_reached, ERROR, ForeignScanState::fdw_state, PgFdwScanState::fetch_ct_2, PgFdwScanState::fetch_size, i, IsA, make_tuple_from_result_row(), MemoryContextReset(), MemoryContextSwitchTo(), PgFdwScanState::next_tuple, PgFdwScanState::num_tuples, palloc0(), PgFdwConnState::pendingAreq, PG_END_TRY, PG_FINALLY, PG_TRY, pgfdw_exec_query(), pgfdw_get_result(), pgfdw_report_error(), PGRES_TUPLES_OK, PlanState::plan, PQclear(), PQntuples(), PQresultStatus(), ScanState::ps, PgFdwScanState::query, PgFdwScanState::rel, PgFdwScanState::retrieved_attrs, snprintf, ForeignScanState::ss, PgFdwScanState::temp_cxt, and PgFdwScanState::tuples.
Referenced by postgresForeignAsyncNotify(), postgresIterateForeignScan(), postgresReScanForeignScan(), and process_pending_request().
|
static |
Definition at line 7475 of file postgres_fdw.c.
References Assert(), create_cursor(), ERROR, ForeignScanState::fdw_state, pgfdw_report_error(), PQsendQuery(), AsyncRequest::requestee, and snprintf.
Referenced by postgresForeignAsyncConfigureWait(), and produce_tuple_asynchronously().
EquivalenceMember * find_em_for_rel | ( | PlannerInfo * | root, |
EquivalenceClass * | ec, | ||
RelOptInfo * | rel | ||
) |
Definition at line 7829 of file postgres_fdw.c.
References bms_intersect(), bms_is_empty, bms_is_subset(), EquivalenceClass::ec_members, EquivalenceMember::em_expr, EquivalenceMember::em_relids, PgFdwRelationInfo::hidden_subquery_rels, is_foreign_expr(), lfirst, RelOptInfo::relids, and root.
Referenced by appendOrderByClause(), get_useful_pathkeys_for_relation(), and is_foreign_pathkey().
EquivalenceMember * find_em_for_rel_target | ( | PlannerInfo * | root, |
EquivalenceClass * | ec, | ||
RelOptInfo * | rel | ||
) |
Definition at line 7865 of file postgres_fdw.c.
References arg, EquivalenceClass::ec_members, EquivalenceMember::em_expr, EquivalenceMember::em_is_child, EquivalenceMember::em_is_const, equal(), PathTarget::exprs, get_pathtarget_sortgroupref, get_sortgroupref_clause_noerr(), i, is_foreign_expr(), IsA, lfirst, RelOptInfo::reltarget, and root.
Referenced by add_foreign_ordered_paths(), and appendOrderByClause().
|
static |
Definition at line 2389 of file postgres_fdw.c.
References Append::appendplans, bms_is_member(), ForeignScan::fs_base_relids, IsA, list_length(), list_nth(), outerPlan, and plan.
Referenced by postgresPlanDirectModify().
|
static |
Definition at line 4383 of file postgres_fdw.c.
References Assert(), PgFdwModifyState::conn, deallocate_query(), and ReleaseConnection().
Referenced by postgresEndForeignInsert(), and postgresEndForeignModify().
|
static |
Definition at line 6486 of file postgres_fdw.c.
References add_to_flat_tlist(), Assert(), RestrictInfo::clause, get_pathtarget_sortgroupref, get_sortgroupref_clause_noerr(), Query::groupClause, PgFdwRelationInfo::grouped_tlist, Query::groupingSets, i, if(), is_foreign_expr(), is_foreign_param(), IsA, lappend(), lfirst, lfirst_node, list_concat(), list_length(), list_make1, PgFdwRelationInfo::local_conds, make_restrictinfo(), makeTargetEntry(), NIL, PgFdwRelationInfo::outerrel, psprintf(), pull_var_clause(), PgFdwRelationInfo::pushdown_safe, PVC_INCLUDE_AGGREGATES, PgFdwRelationInfo::rel_startup_cost, PgFdwRelationInfo::rel_total_cost, PgFdwRelationInfo::relation_name, RelOptInfo::relids, RelOptInfo::reltarget, PgFdwRelationInfo::remote_conds, TargetEntry::ressortgroupref, PgFdwRelationInfo::retrieved_rows, and root.
Referenced by add_foreign_grouping_paths().
|
static |
Definition at line 5793 of file postgres_fdw.c.
References Assert(), bms_add_members(), bms_is_empty, bms_is_subset(), bms_nonempty_difference(), bms_union(), RestrictInfo::clause, elog, ERROR, get_jointype_name(), PgFdwRelationInfo::hidden_subquery_rels, if(), PgFdwRelationInfo::innerrel, is_foreign_expr(), IS_OTHER_REL, IS_OUTER_JOIN, JOIN_FULL, JOIN_INNER, JOIN_LEFT, JOIN_RIGHT, JOIN_SEMI, PgFdwRelationInfo::joinclauses, PgFdwRelationInfo::jointype, lappend(), lfirst, lfirst_node, list_concat(), list_copy(), list_length(), PgFdwRelationInfo::local_conds, PgFdwRelationInfo::lower_subquery_rels, PgFdwRelationInfo::make_innerrel_subquery, PgFdwRelationInfo::make_outerrel_subquery, merge_fdw_options(), NIL, PgFdwRelationInfo::outerrel, PlaceHolderInfo::ph_eval_at, psprintf(), PgFdwRelationInfo::pushdown_safe, PgFdwRelationInfo::rel_startup_cost, PgFdwRelationInfo::rel_total_cost, PgFdwRelationInfo::relation_index, PgFdwRelationInfo::relation_name, RelOptInfo::relids, PgFdwRelationInfo::remote_conds, JoinPathExtraData::restrictlist, PgFdwRelationInfo::retrieved_rows, RINFO_IS_PUSHED_DOWN, root, semijoin_target_ok(), PgFdwRelationInfo::server, RelOptInfo::top_parent_relids, PgFdwRelationInfo::use_remote_estimate, and PgFdwRelationInfo::user.
Referenced by postgresGetForeignJoinPaths().
|
static |
Definition at line 7930 of file postgres_fdw.c.
References defGetString(), DefElem::defname, GetForeignServer(), GetForeignTable(), lfirst, list_concat(), NIL, options, ForeignServer::options, ForeignTable::options, parse_int(), RelationGetRelid, and ForeignTable::serverid.
Referenced by create_foreign_modify(), and postgresGetForeignModifyBatchSize().
|
static |
Definition at line 3597 of file postgres_fdw.c.
References conn, elog, ERROR, PG_END_TRY, PG_FINALLY, PG_TRY, pgfdw_exec_query(), pgfdw_report_error(), PGRES_TUPLES_OK, PQclear(), PQgetvalue(), and PQresultStatus().
Referenced by estimate_path_cost_size().
|
static |
Definition at line 4611 of file postgres_fdw.c.
References apply_returning_filter(), Assert(), PgFdwDirectModifyState::attinmeta, ExecClearTuple(), ExecStoreAllNullTuple(), ExecStoreHeapTuple(), ForeignScanState::fdw_state, PgFdwDirectModifyState::has_returning, make_tuple_from_result_row(), PgFdwDirectModifyState::next_tuple, PgFdwDirectModifyState::num_tuples, PG_CATCH, PG_END_TRY, PG_RE_THROW, PG_TRY, PQclear(), ScanState::ps, PgFdwDirectModifyState::rel, PgFdwDirectModifyState::result, ForeignScanState::resultRelInfo, PgFdwDirectModifyState::retrieved_attrs, PgFdwDirectModifyState::set_processed, ForeignScanState::ss, ScanState::ss_ScanTupleSlot, PlanState::state, and PgFdwDirectModifyState::temp_cxt.
Referenced by postgresIterateDirectModify().
|
static |
Definition at line 1444 of file postgres_fdw.c.
References CreateTupleDescCopy(), ForeignScan::fdw_scan_tlist, get_rel_type_id(), i, IsA, list_nth(), list_nth_node, OidIsValid, PlanState::plan, ScanState::ps, RangeTblEntry::relid, RTE_RELATION, RangeTblEntry::rtekind, ForeignScanState::ss, ScanState::ss_ScanTupleSlot, PlanState::state, TupleTableSlot::tts_tupleDescriptor, TupleDescAttr(), Var::varattno, and Var::varno.
Referenced by postgresBeginDirectModify(), and postgresBeginForeignScan().
|
static |
Definition at line 810 of file postgres_fdw.c.
References Assert(), bms_is_empty, bms_overlap(), eclass_useful_for_merging(), RelOptInfo::has_eclass_joins, IS_OTHER_REL, RelOptInfo::joininfo, lappend(), lfirst, list_append_unique_ptr(), NIL, RelOptInfo::relids, root, RelOptInfo::top_parent_relids, and update_mergeclause_eclasses().
Referenced by get_useful_pathkeys_for_relation().
|
static |
Definition at line 906 of file postgres_fdw.c.
References BTLessStrategyNumber, EquivalenceClass::ec_opfamilies, find_em_for_rel(), get_useful_ecs_for_relation(), if(), is_foreign_pathkey(), is_shippable(), lappend(), lfirst, linitial, linitial_oid, list_copy(), list_length(), list_make1, make_canonical_pathkey(), NIL, PgFdwRelationInfo::qp_is_pushdown_safe, root, and PgFdwRelationInfo::use_remote_estimate.
Referenced by add_paths_with_pathkeys_for_rel().
|
static |
Definition at line 4684 of file postgres_fdw.c.
References Assert(), PgFdwDirectModifyState::attnoMap, PgFdwDirectModifyState::ctidAttno, TargetEntry::expr, PgFdwDirectModifyState::hasSystemCols, i, IsA, lfirst, list_member_int(), TupleDescData::natts, PgFdwDirectModifyState::oidAttno, palloc0(), RelationGetDescr, PgFdwDirectModifyState::resultRel, PgFdwDirectModifyState::retrieved_attrs, SelfItemPointerAttributeNumber, Var::varattno, and Var::varno.
Referenced by postgresBeginDirectModify().
|
static |
Definition at line 7569 of file postgres_fdw.c.
References ErrorContextCallback::arg, Assert(), AttInMetadata::attinfuncs, AttInMetadata::attioparams, AttInMetadata::atttypmods, ErrorContextCallback::callback, conversion_error_callback(), CStringGetDatum(), ConversionLocation::cur_attno, DatumGetPointer(), DirectFunctionCall1, elog, ERROR, error_context_stack, ConversionLocation::fsstate, heap_form_tuple(), HeapTupleHeaderSetCmin(), HeapTupleHeaderSetXmax(), HeapTupleHeaderSetXmin(), i, InputFunctionCall(), InvalidTransactionId, j, lfirst_int, MemoryContextReset(), MemoryContextSwitchTo(), TupleDescData::natts, palloc(), palloc0(), PQgetisnull(), PQgetvalue(), PQnfields(), PQntuples(), ErrorContextCallback::previous, ConversionLocation::rel, RelationGetDescr, SelfItemPointerAttributeNumber, ForeignScanState::ss, ScanState::ss_ScanTupleSlot, HeapTupleHeaderData::t_ctid, HeapTupleData::t_data, HeapTupleData::t_self, tidin(), TupleTableSlot::tts_tupleDescriptor, and values.
Referenced by analyze_row_processor(), fetch_more_data(), get_returning_data(), and store_returning_result().
|
static |
Definition at line 6280 of file postgres_fdw.c.
References Assert(), PgFdwRelationInfo::async_capable, PgFdwRelationInfo::fdw_startup_cost, PgFdwRelationInfo::fdw_tuple_cost, PgFdwRelationInfo::fetch_size, Max, PgFdwRelationInfo::server, ForeignServer::serverid, PgFdwRelationInfo::shippable_extensions, and PgFdwRelationInfo::use_remote_estimate.
Referenced by add_foreign_final_paths(), add_foreign_grouping_paths(), add_foreign_ordered_paths(), and foreign_join_ok().
PG_FUNCTION_INFO_V1 | ( | postgres_fdw_handler | ) |
Datum postgres_fdw_handler | ( | PG_FUNCTION_ARGS | ) |
Definition at line 552 of file postgres_fdw.c.
References FdwRoutine::AddForeignUpdateTargets, FdwRoutine::AnalyzeForeignTable, FdwRoutine::BeginDirectModify, FdwRoutine::BeginForeignInsert, FdwRoutine::BeginForeignModify, FdwRoutine::BeginForeignScan, FdwRoutine::EndDirectModify, FdwRoutine::EndForeignInsert, FdwRoutine::EndForeignModify, FdwRoutine::EndForeignScan, FdwRoutine::ExecForeignBatchInsert, FdwRoutine::ExecForeignDelete, FdwRoutine::ExecForeignInsert, FdwRoutine::ExecForeignTruncate, FdwRoutine::ExecForeignUpdate, FdwRoutine::ExplainDirectModify, FdwRoutine::ExplainForeignModify, FdwRoutine::ExplainForeignScan, FdwRoutine::ForeignAsyncConfigureWait, FdwRoutine::ForeignAsyncNotify, FdwRoutine::ForeignAsyncRequest, FdwRoutine::GetForeignJoinPaths, FdwRoutine::GetForeignModifyBatchSize, FdwRoutine::GetForeignPaths, FdwRoutine::GetForeignPlan, FdwRoutine::GetForeignRelSize, FdwRoutine::GetForeignUpperPaths, FdwRoutine::ImportForeignSchema, FdwRoutine::IsForeignPathAsyncCapable, FdwRoutine::IsForeignRelUpdatable, FdwRoutine::IterateDirectModify, FdwRoutine::IterateForeignScan, makeNode, PG_RETURN_POINTER, FdwRoutine::PlanDirectModify, FdwRoutine::PlanForeignModify, postgresAddForeignUpdateTargets(), postgresAnalyzeForeignTable(), postgresBeginDirectModify(), postgresBeginForeignInsert(), postgresBeginForeignModify(), postgresBeginForeignScan(), postgresEndDirectModify(), postgresEndForeignInsert(), postgresEndForeignModify(), postgresEndForeignScan(), postgresExecForeignBatchInsert(), postgresExecForeignDelete(), postgresExecForeignInsert(), postgresExecForeignTruncate(), postgresExecForeignUpdate(), postgresExplainDirectModify(), postgresExplainForeignModify(), postgresExplainForeignScan(), postgresForeignAsyncConfigureWait(), postgresForeignAsyncNotify(), postgresForeignAsyncRequest(), postgresGetForeignJoinPaths(), postgresGetForeignModifyBatchSize(), postgresGetForeignPaths(), postgresGetForeignPlan(), postgresGetForeignRelSize(), postgresGetForeignUpperPaths(), postgresImportForeignSchema(), postgresIsForeignPathAsyncCapable(), postgresIsForeignRelUpdatable(), postgresIterateDirectModify(), postgresIterateForeignScan(), postgresPlanDirectModify(), postgresPlanForeignModify(), postgresRecheckForeignScan(), postgresReScanForeignScan(), FdwRoutine::RecheckForeignScan, and FdwRoutine::ReScanForeignScan.
|
static |
Definition at line 5077 of file postgres_fdw.c.
References ALLOCSET_SMALL_SIZES, AllocSetContextCreate, analyze_row_processor(), ANALYZE_SAMPLE_AUTO, ANALYZE_SAMPLE_BERNOULLI, ANALYZE_SAMPLE_OFF, ANALYZE_SAMPLE_RANDOM, ANALYZE_SAMPLE_SYSTEM, PgFdwAnalyzeState::anl_cxt, appendStringInfo(), Assert(), PgFdwAnalyzeState::attinmeta, CHECK_FOR_INTERRUPTS, close_cursor(), conn, CurrentMemoryContext, cursor_number, StringInfoData::data, defGetString(), DefElem::defname, deparseAnalyzeSql(), ereport, errcode(), errmsg(), ERROR, fetch_size, GetConnection(), GetCursorNumber(), GetForeignServer(), GetForeignTable(), GetUserMapping(), i, initStringInfo(), lfirst, PgFdwAnalyzeState::numrows, ForeignServer::options, ForeignTable::options, parse_int(), PG_CATCH, PG_END_TRY, PG_RE_THROW, PG_TRY, pgfdw_exec_query(), pgfdw_report_error(), PGRES_COMMAND_OK, PGRES_TUPLES_OK, postgresGetAnalyzeInfoForForeignTable(), PQclear(), PQntuples(), PQresultStatus(), PQserverVersion(), RelationData::rd_rel, PgFdwAnalyzeState::rel, RelationGetDescr, RelationGetRelationName, RelationGetRelid, ReleaseConnection(), reservoir_init_selection_state(), PgFdwAnalyzeState::retrieved_attrs, PgFdwAnalyzeState::rows, PgFdwAnalyzeState::rowstoskip, PgFdwAnalyzeState::rstate, PgFdwAnalyzeState::samplerows, server_version_num, ForeignTable::serverid, snprintf, PgFdwAnalyzeState::targrows, PgFdwAnalyzeState::temp_cxt, TupleDescGetAttInMetadata(), user, and value.
Referenced by postgresAnalyzeForeignTable().
|
static |
Definition at line 1749 of file postgres_fdw.c.
References add_row_identity_var(), InvalidOid, makeVar(), root, and SelfItemPointerAttributeNumber.
Referenced by postgres_fdw_handler().
|
static |
Definition at line 4942 of file postgres_fdw.c.
References conn, StringInfoData::data, deparseAnalyzeSizeSql(), elog, ERROR, GetConnection(), GetForeignTable(), GetUserMapping(), initStringInfo(), PG_END_TRY, PG_FINALLY, PG_TRY, pgfdw_exec_query(), pgfdw_report_error(), PGRES_TUPLES_OK, postgresAcquireSampleRowsFunc(), PQclear(), PQgetvalue(), PQnfields(), PQntuples(), PQresultStatus(), RelationData::rd_rel, RelationGetRelid, ReleaseConnection(), ForeignTable::serverid, and user.
Referenced by postgres_fdw_handler().
|
static |
Definition at line 2647 of file postgres_fdw.c.
References ALLOCSET_SMALL_SIZES, AllocSetContextCreate, boolVal, ForeignScan::checkAsUser, EXEC_FLAG_EXPLAIN_ONLY, ExecOpenScanRelation(), ForeignScan::fdw_exprs, ForeignScan::fdw_private, ForeignScan::fdw_scan_tlist, ForeignScanState::fdw_state, FdwDirectModifyPrivateHasReturning, FdwDirectModifyPrivateRetrievedAttrs, FdwDirectModifyPrivateSetProcessed, FdwDirectModifyPrivateUpdateSql, get_tupdesc_for_join_scan_tuples(), GetConnection(), GetForeignTable(), GetUserId(), GetUserMapping(), if(), init_returning_filter(), list_length(), list_nth(), OidIsValid, palloc0(), PlanState::plan, prepare_query_params(), ScanState::ps, RelationGetDescr, RelationGetRelid, ForeignScanState::resultRelInfo, ResultRelInfo::ri_RangeTableIndex, ForeignScan::scan, Scan::scanrelid, ForeignScanState::ss, ScanState::ss_currentRelation, PlanState::state, strVal, TupleDescGetAttInMetadata(), and user.
Referenced by postgres_fdw_handler().
|
static |
Definition at line 2158 of file postgres_fdw.c.
References Assert(), CompactAttribute::attisdropped, attnum, castNode, CMD_INSERT, CMD_UPDATE, copyObject, create_foreign_modify(), StringInfoData::data, deparseInsertSql(), elog, ereport, errcode(), errmsg(), ERROR, exec_rt_fetch(), initStringInfo(), lappend_int(), TupleDescData::natts, NIL, ONCONFLICT_NONE, ONCONFLICT_NOTHING, PlanState::plan, plan, ModifyTableState::ps, RelationGetDescr, RelationGetRelationName, RelationGetRelid, RangeTblEntry::relid, ModifyTableState::resultRelInfo, ResultRelInfo::ri_FdwState, ResultRelInfo::ri_RangeTableIndex, ResultRelInfo::ri_RelationDesc, ResultRelInfo::ri_returningList, ResultRelInfo::ri_RootResultRelInfo, ResultRelInfo::ri_usesFdwDirectModify, ResultRelInfo::ri_WithCheckOptions, PlanState::state, and TupleDescCompactAttr().
Referenced by postgres_fdw_handler().
|
static |
Definition at line 1916 of file postgres_fdw.c.
References boolVal, create_foreign_modify(), EXEC_FLAG_EXPLAIN_ONLY, exec_rt_fetch(), FdwModifyPrivateHasReturning, FdwModifyPrivateLen, FdwModifyPrivateRetrievedAttrs, FdwModifyPrivateTargetAttnums, FdwModifyPrivateUpdateSql, intVal, list_nth(), ModifyTableState::operation, outerPlanState, plan, ModifyTableState::ps, ResultRelInfo::ri_FdwState, ResultRelInfo::ri_RangeTableIndex, PlanState::state, and strVal.
Referenced by postgres_fdw_handler().
|
static |
Definition at line 1496 of file postgres_fdw.c.
References ALLOCSET_DEFAULT_SIZES, ALLOCSET_SMALL_SIZES, AllocSetContextCreate, PlanState::async_capable, bms_next_member(), ForeignScan::checkAsUser, EXEC_FLAG_EXPLAIN_ONLY, exec_rt_fetch(), ForeignScan::fdw_exprs, ForeignScan::fdw_private, ForeignScanState::fdw_state, FdwScanPrivateFetchSize, FdwScanPrivateRetrievedAttrs, FdwScanPrivateSelectSql, ForeignScan::fs_base_relids, get_tupdesc_for_join_scan_tuples(), GetConnection(), GetCursorNumber(), GetForeignTable(), GetUserId(), GetUserMapping(), if(), intVal, list_length(), list_nth(), OidIsValid, palloc0(), PlanState::plan, prepare_query_params(), ScanState::ps, RelationGetDescr, ForeignScan::scan, Scan::scanrelid, ForeignScanState::ss, ScanState::ss_currentRelation, PlanState::state, strVal, TupleDescGetAttInMetadata(), and user.
Referenced by postgres_fdw_handler().
|
static |
Definition at line 2808 of file postgres_fdw.c.
References PgFdwDirectModifyState::conn, ForeignScanState::fdw_state, if(), PQclear(), ReleaseConnection(), and PgFdwDirectModifyState::result.
Referenced by postgres_fdw_handler().
|
static |
Definition at line 2289 of file postgres_fdw.c.
References Assert(), PgFdwModifyState::aux_fmstate, finish_foreign_modify(), and ResultRelInfo::ri_FdwState.
Referenced by postgres_fdw_handler().
|
static |
Definition at line 2140 of file postgres_fdw.c.
References finish_foreign_modify(), if(), and ResultRelInfo::ri_FdwState.
Referenced by postgres_fdw_handler().
|
static |
Definition at line 1724 of file postgres_fdw.c.
References close_cursor(), PgFdwScanState::conn, PgFdwScanState::conn_state, PgFdwScanState::cursor_exists, PgFdwScanState::cursor_number, ForeignScanState::fdw_state, if(), and ReleaseConnection().
Referenced by postgres_fdw_handler().
|
static |
Definition at line 2002 of file postgres_fdw.c.
References PgFdwModifyState::aux_fmstate, CMD_INSERT, execute_foreign_modify(), if(), and ResultRelInfo::ri_FdwState.
Referenced by postgres_fdw_handler().
|
static |
Definition at line 2121 of file postgres_fdw.c.
References CMD_DELETE, and execute_foreign_modify().
Referenced by postgres_fdw_handler().
|
static |
Definition at line 1973 of file postgres_fdw.c.
References PgFdwModifyState::aux_fmstate, CMD_INSERT, execute_foreign_modify(), if(), and ResultRelInfo::ri_FdwState.
Referenced by postgres_fdw_handler().
|
static |
Definition at line 2984 of file postgres_fdw.c.
References Assert(), conn, StringInfoData::data, defGetBoolean(), DefElem::defname, deparseTruncateSql(), do_sql_command(), ereport, errcode(), errmsg(), ERROR, GetConnection(), GetForeignServer(), GetForeignTable(), GetUserId(), GetUserMapping(), initStringInfo(), InvalidOid, lfirst, OidIsValid, ForeignServer::options, ForeignTable::options, pfree(), RelationGetRelationName, RelationGetRelid, ForeignTable::serverid, and user.
Referenced by postgres_fdw_handler().
|
static |
Definition at line 2102 of file postgres_fdw.c.
References CMD_UPDATE, and execute_foreign_modify().
Referenced by postgres_fdw_handler().
|
static |
Definition at line 2966 of file postgres_fdw.c.
References ExplainPropertyText(), FdwDirectModifyPrivateUpdateSql, list_nth(), PlanState::plan, ScanState::ps, ForeignScanState::ss, strVal, and ExplainState::verbose.
Referenced by postgres_fdw_handler().
|
static |
Definition at line 2938 of file postgres_fdw.c.
References ExplainPropertyInteger(), ExplainPropertyText(), FdwModifyPrivateUpdateSql, list_nth(), ResultRelInfo::ri_BatchSize, strVal, and ExplainState::verbose.
Referenced by postgres_fdw_handler().
|
static |
Definition at line 2831 of file postgres_fdw.c.
References appendStringInfo(), appendStringInfoChar(), appendStringInfoString(), Assert(), bms_is_member(), bms_next_member(), castNode, StringInfoData::data, ExplainPropertyText(), FdwScanPrivateRelations, FdwScanPrivateSelectSql, get_namespace_name_or_temp(), get_rel_name(), get_rel_namespace(), list_length(), list_nth(), makeStringInfo(), PlanState::plan, plan, ScanState::ps, quote_identifier(), RangeTblEntry::relid, relname, rt_fetch, ExplainState::rtable, ExplainState::rtable_names, RTE_RELATION, RangeTblEntry::rtekind, ForeignScanState::ss, strVal, and ExplainState::verbose.
Referenced by postgres_fdw_handler().
|
static |
Definition at line 7289 of file postgres_fdw.c.
References AddWaitEventToSet(), AppendState::as_eventset, AppendState::as_needrequest, Assert(), bms_is_empty, AsyncRequest::callback_pending, complete_pending_request(), ForeignScanState::fdw_state, fetch_more_data_begin(), GetNumRegisteredWaitEvents(), PQsocket(), process_pending_request(), AsyncRequest::request_complete, AsyncRequest::requestee, AsyncRequest::requestor, and WL_SOCKET_READABLE.
Referenced by postgres_fdw_handler().
|
static |
Definition at line 7366 of file postgres_fdw.c.
References Assert(), AsyncRequest::callback_pending, ERROR, ForeignScanState::fdw_state, fetch_more_data(), pgfdw_report_error(), PQconsumeInput(), produce_tuple_asynchronously(), and AsyncRequest::requestee.
Referenced by postgres_fdw_handler().
|
static |
Definition at line 7279 of file postgres_fdw.c.
References produce_tuple_asynchronously().
Referenced by postgres_fdw_handler().
|
static |
Definition at line 5006 of file postgres_fdw.c.
References conn, StringInfoData::data, deparseAnalyzeInfoSql(), elog, ERROR, GetConnection(), GetForeignTable(), GetUserMapping(), initStringInfo(), PG_END_TRY, PG_FINALLY, PG_TRY, pgfdw_exec_query(), pgfdw_report_error(), PGRES_TUPLES_OK, PQclear(), PQgetvalue(), PQnfields(), PQntuples(), PQresultStatus(), RelationData::rd_rel, RelationGetRelid, ReleaseConnection(), ForeignTable::serverid, and user.
Referenced by postgresAcquireSampleRowsFunc().
|
static |
Definition at line 6341 of file postgres_fdw.c.
References add_path(), add_paths_with_pathkeys_for_rel(), PgFdwRelationInfo::attrs_used, bms_is_empty, clauselist_selectivity(), CMD_DELETE, CMD_UPDATE, cost_qual_eval(), create_foreign_join_path(), DEBUG3, PgFdwRelationInfo::disabled_nodes, elog, estimate_path_cost_size(), foreign_join_ok(), GetExistingLocalJoinPath(), JOIN_INNER, PgFdwRelationInfo::joinclause_sel, PgFdwRelationInfo::joinclauses, PgFdwRelationInfo::jointype, RelOptInfo::lateral_relids, PgFdwRelationInfo::local_conds, PgFdwRelationInfo::local_conds_cost, PgFdwRelationInfo::local_conds_sel, NIL, palloc0(), pfree(), PgFdwRelationInfo::pushdown_safe, RelOptInfo::reltarget, JoinPathExtraData::restrictlist, root, PgFdwRelationInfo::rows, RelOptInfo::rows, JoinPathExtraData::sjinfo, PgFdwRelationInfo::startup_cost, PgFdwRelationInfo::total_cost, PgFdwRelationInfo::use_remote_estimate, PgFdwRelationInfo::width, and PathTarget::width.
Referenced by postgres_fdw_handler().
|
static |
Definition at line 2035 of file postgres_fdw.c.
References Assert(), PgFdwModifyState::aux_fmstate, PgFdwModifyState::batch_size, get_batch_size_option(), list_length(), Min, NIL, PgFdwModifyState::p_nums, PQ_QUERY_PARAM_MAX_LIMIT, ResultRelInfo::ri_BatchSize, ResultRelInfo::ri_FdwState, ResultRelInfo::ri_projectReturning, ResultRelInfo::ri_RelationDesc, ResultRelInfo::ri_TrigDesc, ResultRelInfo::ri_WithCheckOptions, PgFdwModifyState::target_attrs, TriggerDesc::trig_insert_after_row, and TriggerDesc::trig_insert_before_row.
Referenced by postgres_fdw_handler().
|
static |
Definition at line 1013 of file postgres_fdw.c.
References add_path(), add_paths_with_pathkeys_for_rel(), arg, Assert(), bms_del_member(), bms_is_empty, bms_union(), RestrictInfo::clause, create_foreignscan_path(), PgFdwRelationInfo::disabled_nodes, ec_member_matches_foreign(), estimate_path_cost_size(), generate_implied_equalities_for_column(), get_baserel_parampathinfo(), RelOptInfo::has_eclass_joins, is_foreign_expr(), join_clause_is_movable_to(), RelOptInfo::joininfo, lappend(), RelOptInfo::lateral_referencers, RelOptInfo::lateral_relids, lfirst, list_append_unique_ptr(), NIL, ParamPathInfo::ppi_clauses, ParamPathInfo::ppi_req_outer, ParamPathInfo::ppi_rows, RelOptInfo::relid, root, PgFdwRelationInfo::rows, PgFdwRelationInfo::startup_cost, PgFdwRelationInfo::total_cost, and PgFdwRelationInfo::use_remote_estimate.
Referenced by postgres_fdw_handler().
|
static |
Definition at line 1227 of file postgres_fdw.c.
References Assert(), boolVal, build_tlist_to_deparse(), change_plan_targetlist(), RestrictInfo::clause, deparseSelectStmtForRel(), extract_actual_clauses(), ForeignPath::fdw_private, FdwPathPrivateHasFinalSort, FdwPathPrivateHasLimit, PgFdwRelationInfo::fetch_size, PgFdwRelationInfo::final_remote_exprs, if(), initStringInfo(), is_foreign_expr(), IS_JOIN_REL, IS_SIMPLE_REL, IS_UPPER_REL, IsA, JOIN_INNER, Join::joinqual, Join::jointype, lappend(), lfirst, lfirst_node, list_delete(), list_make3, list_member_ptr(), list_nth(), PgFdwRelationInfo::local_conds, make_foreignscan(), makeInteger(), makeString(), NIL, Path::parallel_safe, ForeignPath::path, Path::pathkeys, Plan::qual, PgFdwRelationInfo::relation_name, RelOptInfo::relid, PgFdwRelationInfo::remote_conds, and root.
Referenced by postgres_fdw_handler().
|
static |
Definition at line 622 of file postgres_fdw.c.
References apply_server_options(), apply_table_options(), PgFdwRelationInfo::async_capable, PgFdwRelationInfo::attrs_used, RelOptInfo::baserestrictinfo, classifyConditions(), RestrictInfo::clause, clauselist_selectivity(), cost_qual_eval(), DEFAULT_FDW_STARTUP_COST, DEFAULT_FDW_TUPLE_COST, PgFdwRelationInfo::disabled_nodes, estimate_path_cost_size(), PathTarget::exprs, PgFdwRelationInfo::fdw_startup_cost, PgFdwRelationInfo::fdw_tuple_cost, PgFdwRelationInfo::fetch_size, GetForeignServer(), GetForeignTable(), GetUserId(), GetUserMapping(), PgFdwRelationInfo::hidden_subquery_rels, JOIN_INNER, lfirst_node, PgFdwRelationInfo::local_conds, PgFdwRelationInfo::local_conds_cost, PgFdwRelationInfo::local_conds_sel, PgFdwRelationInfo::lower_subquery_rels, PgFdwRelationInfo::make_innerrel_subquery, PgFdwRelationInfo::make_outerrel_subquery, MAXALIGN, NIL, OidIsValid, RelOptInfo::pages, palloc0(), psprintf(), pull_varattnos(), PgFdwRelationInfo::pushdown_safe, PgFdwRelationInfo::rel_startup_cost, PgFdwRelationInfo::rel_total_cost, PgFdwRelationInfo::relation_index, PgFdwRelationInfo::relation_name, RelOptInfo::relid, RelOptInfo::reltarget, PgFdwRelationInfo::remote_conds, PgFdwRelationInfo::retrieved_rows, root, PgFdwRelationInfo::rows, RelOptInfo::rows, PgFdwRelationInfo::server, ForeignServer::serverid, ForeignTable::serverid, set_baserel_size_estimates(), PgFdwRelationInfo::shippable_extensions, SizeofHeapTupleHeader, PgFdwRelationInfo::startup_cost, PgFdwRelationInfo::table, PgFdwRelationInfo::total_cost, RelOptInfo::tuples, PgFdwRelationInfo::use_remote_estimate, PgFdwRelationInfo::user, RelOptInfo::userid, PgFdwRelationInfo::width, and PathTarget::width.
Referenced by postgres_fdw_handler().
|
static |
Definition at line 6726 of file postgres_fdw.c.
References add_foreign_final_paths(), add_foreign_grouping_paths(), add_foreign_ordered_paths(), elog, ERROR, palloc0(), PgFdwRelationInfo::pushdown_safe, root, PgFdwRelationInfo::stage, UPPERREL_FINAL, UPPERREL_GROUP_AGG, and UPPERREL_ORDERED.
Referenced by postgres_fdw_handler().
|
static |
Definition at line 5455 of file postgres_fdw.c.
References appendStringInfo(), appendStringInfoChar(), appendStringInfoString(), Assert(), attname, attnotnull, buf, conn, CppAsString2, defGetBoolean(), DefElem::defname, deparseStringLiteral(), ereport, errcode(), errmsg(), ERROR, FDW_IMPORT_SCHEMA_EXCEPT, FDW_IMPORT_SCHEMA_LIMIT_TO, GetConnection(), GetForeignServer(), GetUserId(), GetUserMapping(), i, initStringInfo(), lappend(), lfirst, NIL, PG_END_TRY, PG_FINALLY, PG_TRY, pgfdw_exec_query(), pgfdw_report_error(), PGRES_TUPLES_OK, PQclear(), PQgetisnull(), PQgetvalue(), PQntuples(), PQresultStatus(), PQserverVersion(), pstrdup(), quote_identifier(), ReleaseConnection(), RangeVar::relname, resetStringInfo(), ForeignServer::serverid, ForeignServer::servername, and stmt.
Referenced by postgres_fdw_handler().
|
static |
Definition at line 7266 of file postgres_fdw.c.
References PgFdwRelationInfo::async_capable.
Referenced by postgres_fdw_handler().
|
static |
Definition at line 2313 of file postgres_fdw.c.
References CMD_DELETE, CMD_INSERT, CMD_UPDATE, defGetBoolean(), DefElem::defname, GetForeignServer(), GetForeignTable(), lfirst, ForeignServer::options, ForeignTable::options, RelationGetRelid, and ForeignTable::serverid.
Referenced by postgres_fdw_handler().
|
static |
Definition at line 2764 of file postgres_fdw.c.
References Assert(), ExecClearTuple(), execute_dml_stmt(), ForeignScanState::fdw_state, get_returning_data(), PgFdwDirectModifyState::has_returning, if(), PlanState::instrument, PgFdwDirectModifyState::num_tuples, ScanState::ps, ForeignScanState::resultRelInfo, PgFdwDirectModifyState::set_processed, ForeignScanState::ss, ScanState::ss_ScanTupleSlot, PlanState::state, and Instrumentation::tuplecount.
Referenced by postgres_fdw_handler().
|
static |
Definition at line 1601 of file postgres_fdw.c.
References PgFdwScanState::async_capable, create_cursor(), PgFdwScanState::cursor_exists, PgFdwScanState::eof_reached, ExecClearTuple(), ExecStoreHeapTuple(), ForeignScanState::fdw_state, fetch_more_data(), if(), PgFdwScanState::next_tuple, PgFdwScanState::num_tuples, ForeignScanState::ss, ScanState::ss_ScanTupleSlot, and PgFdwScanState::tuples.
Referenced by postgres_fdw_handler().
|
static |
Definition at line 2449 of file postgres_fdw.c.
References Assert(), build_remote_returning(), CMD_DELETE, CMD_UPDATE, StringInfoData::data, deparseDirectDeleteSql(), deparseDirectUpdateSql(), elog, ERROR, TargetEntry::expr, ForeignScan::fdw_exprs, ForeignScan::fdw_private, PgFdwRelationInfo::final_remote_exprs, find_join_rel(), find_modifytable_subplan(), forboth, ForeignScan::fs_relids, get_translated_update_targetlist(), if(), initStringInfo(), InvalidAttrNumber, is_foreign_expr(), lfirst_int, lfirst_node, list_make4, list_nth(), makeBoolean(), makeString(), NIL, NoLock, ForeignScan::operation, plan, rebuild_fdw_scan_tlist(), RangeTblEntry::relid, ForeignScan::resultRelation, root, ForeignScan::scan, Scan::scanrelid, table_close(), and table_open().
Referenced by postgres_fdw_handler().
|
static |
Definition at line 1777 of file postgres_fdw.c.
References CompactAttribute::attisdropped, attnum, bms_next_member(), CMD_DELETE, CMD_INSERT, CMD_UPDATE, StringInfoData::data, deparseDeleteSql(), deparseInsertSql(), deparseUpdateSql(), elog, ERROR, find_base_rel(), FirstLowInvalidHeapAttributeNumber, get_rel_all_updated_cols(), initStringInfo(), InvalidAttrNumber, lappend_int(), list_make5, list_nth(), makeBoolean(), makeInteger(), makeString(), TupleDescData::natts, NIL, NoLock, ONCONFLICT_NONE, ONCONFLICT_NOTHING, plan, planner_rt_fetch, RelationGetDescr, RangeTblEntry::relid, root, table_close(), table_open(), TriggerDesc::trig_update_before_row, RelationData::trigdesc, and TupleDescCompactAttr().
Referenced by postgres_fdw_handler().
|
static |
Definition at line 2357 of file postgres_fdw.c.
References Assert(), ExecCopySlot(), ExecProcNode(), outerPlan, outerPlanState, PlanState::plan, ScanState::ps, ForeignScanState::ss, and TupIsNull.
Referenced by postgres_fdw_handler().
|
static |
Definition at line 1646 of file postgres_fdw.c.
References PgFdwScanState::async_capable, PlanState::chgParam, PgFdwScanState::conn, PgFdwScanState::conn_state, PgFdwScanState::cursor_exists, PgFdwScanState::cursor_number, PgFdwScanState::eof_reached, ERROR, ForeignScanState::fdw_state, PgFdwScanState::fetch_ct_2, fetch_more_data(), if(), PgFdwScanState::next_tuple, PgFdwScanState::num_tuples, PgFdwConnState::pendingAreq, pgfdw_exec_query(), pgfdw_report_error(), PGRES_COMMAND_OK, PQclear(), PQresultStatus(), PQserverVersion(), ScanState::ps, AsyncRequest::requestee, snprintf, ForeignScanState::ss, and PgFdwScanState::tuples.
Referenced by postgres_fdw_handler().
|
static |
Definition at line 4216 of file postgres_fdw.c.
References PgFdwModifyState::conn, ERROR, GetPrepStmtNumber(), NAMEDATALEN, PgFdwModifyState::p_name, pgfdw_get_result(), pgfdw_report_error(), PGRES_COMMAND_OK, PQclear(), PQresultStatus(), PQsendPrepare(), pstrdup(), PgFdwModifyState::query, and snprintf.
Referenced by execute_foreign_modify().
|
static |
Definition at line 4856 of file postgres_fdw.c.
References Assert(), ExecInitExprList(), exprType(), fmgr_info(), getTypeOutputInfo(), i, lfirst, and palloc0().
Referenced by postgresBeginDirectModify(), and postgresBeginForeignScan().
void process_pending_request | ( | AsyncRequest * | areq | ) |
Definition at line 7502 of file postgres_fdw.c.
References Assert(), AsyncRequest::callback_pending, ExecAsyncRequestDone(), ExecAsyncResponse(), ForeignScanState::fdw_state, fetch_more_data(), and AsyncRequest::requestee.
Referenced by create_cursor(), execute_dml_stmt(), execute_foreign_modify(), GetConnection(), pgfdw_exec_query(), and postgresForeignAsyncConfigureWait().
|
static |
Definition at line 4901 of file postgres_fdw.c.
References ExecEvalExpr(), i, lfirst, OutputFunctionCall(), reset_transmission_modes(), and set_transmission_modes().
Referenced by create_cursor(), and execute_dml_stmt().
|
static |
Definition at line 7404 of file postgres_fdw.c.
References Assert(), ExecAsyncRequestDone(), ExecAsyncRequestPending(), PlanState::ExecProcNodeReal, ForeignScanState::fdw_state, fetch_more_data_begin(), AsyncRequest::requestee, and TupIsNull.
Referenced by complete_pending_request(), postgresForeignAsyncNotify(), and postgresForeignAsyncRequest().
|
static |
Definition at line 4531 of file postgres_fdw.c.
References TargetEntry::expr, ForeignScan::fdw_scan_tlist, lappend(), lfirst, list_length(), makeTargetEntry(), and tlist_member().
Referenced by postgresPlanDirectModify().
void reset_transmission_modes | ( | int | nestlevel | ) |
Definition at line 3943 of file postgres_fdw.c.
References AtEOXact_GUC().
Referenced by appendConditions(), appendLimitClause(), appendOrderByClause(), convert_prep_stmt_params(), deparseDirectUpdateSql(), and process_query_params().
|
static |
Definition at line 5754 of file postgres_fdw.c.
References Assert(), bms_is_member(), PathTarget::exprs, IsA, lfirst, pull_var_clause(), PVC_INCLUDE_PLACEHOLDERS, RelOptInfo::relids, RelOptInfo::reltarget, and Var::varno.
Referenced by foreign_join_ok().
int set_transmission_modes | ( | void | ) |
Definition at line 3907 of file postgres_fdw.c.
References DateStyle, extra_float_digits, GUC_ACTION_SAVE, IntervalStyle, INTSTYLE_POSTGRES, NewGUCNestLevel(), PGC_S_SESSION, PGC_USERSET, set_config_option(), and USE_ISO_DATES.
Referenced by appendConditions(), appendLimitClause(), appendOrderByClause(), convert_prep_stmt_params(), deparseDirectUpdateSql(), and process_query_params().
|
static |
Definition at line 4350 of file postgres_fdw.c.
References PgFdwModifyState::attinmeta, ExecForceStoreHeapTuple(), make_tuple_from_result_row(), PG_CATCH, PG_END_TRY, PG_RE_THROW, PG_TRY, PQclear(), PgFdwModifyState::rel, PgFdwModifyState::retrieved_attrs, and PgFdwModifyState::temp_cxt.
Referenced by execute_foreign_modify().
PG_MODULE_MAGIC |
Definition at line 52 of file postgres_fdw.c.