PostgreSQL Source Code
git master
|
#include "postgres.h"
#include "access/htup_details.h"
#include "access/reloptions.h"
#include "catalog/pg_foreign_data_wrapper.h"
#include "catalog/pg_foreign_server.h"
#include "catalog/pg_foreign_table.h"
#include "catalog/pg_user_mapping.h"
#include "foreign/fdwapi.h"
#include "foreign/foreign.h"
#include "funcapi.h"
#include "lib/stringinfo.h"
#include "miscadmin.h"
#include "utils/builtins.h"
#include "utils/memutils.h"
#include "utils/rel.h"
#include "utils/syscache.h"
Go to the source code of this file.
Data Structures | |
struct | ConnectionOption |
Variables | |
static const struct ConnectionOption | libpq_conninfo_options [] |
Definition at line 659 of file foreign.c.
References CStringGetDatum, ereport, errcode(), errmsg(), ERROR, FOREIGNDATAWRAPPERNAME, GetSysCacheOid1, and OidIsValid.
Referenced by convert_foreign_data_wrapper_name(), get_object_address_unqualified(), GetForeignDataWrapperByName(), and objectNamesToOids().
Definition at line 682 of file foreign.c.
References CStringGetDatum, ereport, errcode(), errmsg(), ERROR, FOREIGNSERVERNAME, GetSysCacheOid1, and OidIsValid.
Referenced by convert_server_name(), get_object_address_unqualified(), GetForeignServerByName(), and objectNamesToOids().
Path* GetExistingLocalJoinPath | ( | RelOptInfo * | joinrel | ) |
Definition at line 719 of file foreign.c.
References Assert(), ForeignPath::fdw_outerpath, if(), JoinPath::innerjoinpath, IS_JOIN_REL, IsA, lfirst, makeNode, JoinPath::outerjoinpath, Path::param_info, Path::parent, ForeignPath::path, RelOptInfo::pathlist, Path::pathtype, T_HashJoin, T_MergeJoin, and T_NestLoop.
Referenced by postgresGetForeignJoinPaths().
FdwRoutine* GetFdwRoutine | ( | Oid | fdwhandler | ) |
Definition at line 320 of file foreign.c.
References DatumGetPointer, elog, ERROR, IsA, and OidFunctionCall0.
Referenced by GetFdwRoutineByServerId(), and ImportForeignSchema().
FdwRoutine* GetFdwRoutineByRelId | ( | Oid | relid | ) |
Definition at line 405 of file foreign.c.
References GetFdwRoutineByServerId(), and GetForeignServerIdByRelId().
Referenced by GetFdwRoutineForRelation(), make_modifytable(), and select_rowmark_type().
FdwRoutine* GetFdwRoutineByServerId | ( | Oid | serverid | ) |
Definition at line 363 of file foreign.c.
References elog, ereport, errcode(), errmsg(), ERROR, FOREIGNDATAWRAPPEROID, FOREIGNSERVEROID, GetFdwRoutine(), GETSTRUCT, HeapTupleIsValid, NameStr, ObjectIdGetDatum, OidIsValid, ReleaseSysCache(), and SearchSysCache1().
Referenced by ExecInitForeignScan(), ExecuteTruncateGuts(), GetFdwRoutineByRelId(), and truncate_check_rel().
FdwRoutine* GetFdwRoutineForRelation | ( | Relation | relation, |
bool | makecopy | ||
) |
Definition at line 428 of file foreign.c.
References CacheMemoryContext, GetFdwRoutineByRelId(), MemoryContextAlloc(), palloc(), RelationData::rd_fdwroutine, and RelationGetRelid.
Referenced by acquire_inherited_sample_rows(), add_row_identity_columns(), analyze_rel(), CheckValidRowMarkRel(), EvalPlanQualFetchRowMark(), ExecInitForeignScan(), ExecLockRows(), get_relation_info(), InitResultRelInfo(), and relation_is_updatable().
List* GetForeignColumnOptions | ( | Oid | relid, |
AttrNumber | attnum | ||
) |
Definition at line 287 of file foreign.c.
References attnum, ATTNUM, elog, ERROR, HeapTupleIsValid, Int16GetDatum, NIL, ObjectIdGetDatum, options, ReleaseSysCache(), SearchSysCache2(), SysCacheGetAttr(), and untransformRelOptions().
Referenced by deparseAnalyzeSql(), deparseColumnRef(), and get_file_fdw_attribute_options().
ForeignDataWrapper* GetForeignDataWrapper | ( | Oid | fdwid | ) |
Definition at line 36 of file foreign.c.
References GetForeignDataWrapperExtended().
Referenced by AlterForeignServer(), AlterForeignServerOwner_internal(), AlterUserMapping(), ATExecAlterColumnGenericOptions(), ATExecGenericOptions(), CreateForeignTable(), CreateUserMapping(), fileGetOptions(), get_connect_string(), GetForeignDataWrapperByName(), and ImportForeignSchema().
ForeignDataWrapper* GetForeignDataWrapperByName | ( | const char * | fdwname, |
bool | missing_ok | ||
) |
Definition at line 95 of file foreign.c.
References get_foreign_data_wrapper_oid(), GetForeignDataWrapper(), and OidIsValid.
Referenced by CreateForeignDataWrapper(), and CreateForeignServer().
ForeignDataWrapper* GetForeignDataWrapperExtended | ( | Oid | fdwid, |
bits16 | flags | ||
) |
Definition at line 48 of file foreign.c.
References elog, ERROR, FDW_MISSING_OK, ForeignDataWrapper::fdwhandler, ForeignDataWrapper::fdwid, ForeignDataWrapper::fdwname, ForeignDataWrapper::fdwvalidator, FOREIGNDATAWRAPPEROID, GETSTRUCT, HeapTupleIsValid, NameStr, NIL, ObjectIdGetDatum, ForeignDataWrapper::options, ForeignDataWrapper::owner, palloc(), pstrdup(), ReleaseSysCache(), SearchSysCache1(), SysCacheGetAttr(), and untransformRelOptions().
Referenced by GetForeignDataWrapper(), getObjectDescription(), and getObjectIdentityParts().
ForeignServer* GetForeignServer | ( | Oid | serverid | ) |
Definition at line 110 of file foreign.c.
References GetForeignServerExtended().
Referenced by ATExecAlterColumnGenericOptions(), ATExecGenericOptions(), fileGetOptions(), get_batch_size_option(), GetForeignServerByName(), getObjectDescription(), getObjectIdentityParts(), make_new_connection(), pgfdw_reject_incomplete_xact_state_change(), postgresAcquireSampleRowsFunc(), postgresExecForeignTruncate(), postgresGetForeignRelSize(), postgresImportForeignSchema(), and postgresIsForeignRelUpdatable().
ForeignServer* GetForeignServerByName | ( | const char * | srvname, |
bool | missing_ok | ||
) |
Definition at line 181 of file foreign.c.
References get_foreign_server_oid(), GetForeignServer(), and OidIsValid.
Referenced by AlterUserMapping(), CreateForeignServer(), CreateForeignTable(), CreateUserMapping(), get_connect_string(), get_object_address_usermapping(), ImportForeignSchema(), postgres_fdw_disconnect(), and RemoveUserMapping().
ForeignServer* GetForeignServerExtended | ( | Oid | serverid, |
bits16 | flags | ||
) |
Definition at line 122 of file foreign.c.
References elog, ERROR, ForeignServer::fdwid, FOREIGNSERVEROID, FSV_MISSING_OK, GETSTRUCT, HeapTupleIsValid, NameStr, NIL, ObjectIdGetDatum, ForeignServer::options, ForeignServer::owner, palloc(), pstrdup(), ReleaseSysCache(), SearchSysCache1(), ForeignServer::serverid, ForeignServer::servername, ForeignServer::servertype, ForeignServer::serverversion, SysCacheGetAttr(), TextDatumGetCString, and untransformRelOptions().
Referenced by disconnect_cached_connections(), GetForeignServer(), getObjectDescription(), getObjectIdentityParts(), and postgres_fdw_get_connections().
Definition at line 341 of file foreign.c.
References elog, ERROR, FOREIGNTABLEREL, GETSTRUCT, HeapTupleIsValid, ObjectIdGetDatum, ReleaseSysCache(), and SearchSysCache1().
Referenced by ExecuteTruncateGuts(), get_relation_info(), GetFdwRoutineByRelId(), and truncate_check_rel().
ForeignTable* GetForeignTable | ( | Oid | relid | ) |
Definition at line 249 of file foreign.c.
References elog, ERROR, FOREIGNTABLEREL, GETSTRUCT, HeapTupleIsValid, NIL, ObjectIdGetDatum, ForeignTable::options, palloc(), ReleaseSysCache(), ForeignTable::relid, SearchSysCache1(), ForeignTable::serverid, SysCacheGetAttr(), and untransformRelOptions().
Referenced by check_selective_binary_conversion(), create_foreign_modify(), deparseRelation(), fileGetOptions(), get_batch_size_option(), postgresAcquireSampleRowsFunc(), postgresAnalyzeForeignTable(), postgresBeginDirectModify(), postgresBeginForeignScan(), postgresExecForeignTruncate(), postgresGetForeignRelSize(), and postgresIsForeignRelUpdatable().
UserMapping* GetUserMapping | ( | Oid | userid, |
Oid | serverid | ||
) |
Definition at line 199 of file foreign.c.
References ereport, errcode(), errmsg(), ERROR, GETSTRUCT, HeapTupleIsValid, InvalidOid, MappingUserName, NIL, ObjectIdGetDatum, UserMapping::options, palloc(), ReleaseSysCache(), SearchSysCache2(), UserMapping::serverid, SysCacheGetAttr(), UserMapping::umid, untransformRelOptions(), and UserMapping::userid.
Referenced by create_foreign_modify(), get_connect_string(), postgresAcquireSampleRowsFunc(), postgresAnalyzeForeignTable(), postgresBeginDirectModify(), postgresBeginForeignScan(), postgresExecForeignTruncate(), postgresGetForeignRelSize(), and postgresImportForeignSchema().
Definition at line 586 of file foreign.c.
References libpq_conninfo_options, ConnectionOption::optcontext, and ConnectionOption::optname.
Referenced by postgresql_fdw_validator().
bool IsImportableForeignTable | ( | const char * | tablename, |
ImportForeignSchemaStmt * | stmt | ||
) |
Definition at line 468 of file foreign.c.
References FDW_IMPORT_SCHEMA_ALL, FDW_IMPORT_SCHEMA_EXCEPT, FDW_IMPORT_SCHEMA_LIMIT_TO, lfirst, ImportForeignSchemaStmt::list_type, RangeVar::relname, and ImportForeignSchemaStmt::table_list.
Referenced by ImportForeignSchema().
Datum pg_options_to_table | ( | PG_FUNCTION_ARGS | ) |
Definition at line 508 of file foreign.c.
Datum postgresql_fdw_validator | ( | PG_FUNCTION_ARGS | ) |
Definition at line 610 of file foreign.c.
References appendStringInfo(), buf, DefElem::defname, ereport, errcode(), errhint(), errmsg(), ERROR, initStringInfo(), is_conninfo_option(), lfirst, libpq_conninfo_options, ConnectionOption::optcontext, ConnectionOption::optname, PG_GETARG_DATUM, PG_GETARG_OID, PG_RETURN_BOOL, and untransformRelOptions().
|
static |
Definition at line 508 of file foreign.c.
Referenced by is_conninfo_option(), and postgresql_fdw_validator().