51 elog(
ERROR,
"cache lookup failed for foreign-data wrapper %u", fdwid);
57 fdw->
owner = fdwform->fdwowner;
109 elog(
ERROR,
"cache lookup failed for foreign server %u", serverid);
116 server->
owner = serverform->srvowner;
117 server->
fdwid = serverform->srvfdw;
176 elog(
ERROR,
"cache lookup failed for user mapping %u", umid);
268 if (!tp && missing_ok)
313 (
errcode(ERRCODE_UNDEFINED_OBJECT),
314 errmsg(
"user mapping not found for \"%s\"",
336 elog(
ERROR,
"cache lookup failed for foreign table %u", relid);
375 elog(
ERROR,
"cache lookup failed for attribute %d of relation %u",
406 elog(
ERROR,
"foreign-data wrapper handler function %u did not return an FdwRoutine struct",
426 elog(
ERROR,
"cache lookup failed for foreign table %u", relid);
428 serverid = tableform->ftserver;
451 elog(
ERROR,
"cache lookup failed for foreign server %u", serverid);
453 fdwid = serverform->srvfdw;
459 elog(
ERROR,
"cache lookup failed for foreign-data wrapper %u", fdwid);
461 fdwhandler = fdwform->fdwhandler;
466 (
errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
467 errmsg(
"foreign-data wrapper \"%s\" has no handler",
518 memcpy(cfdwroutine, fdwroutine,
sizeof(
FdwRoutine));
560 if (strcmp(tablename, rv->
relname) == 0)
570 if (strcmp(tablename, rv->
relname) == 0)
597 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
598 errmsg(
"set-valued function called in context that cannot accept a set")));
602 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
603 errmsg(
"materialize mode required, but it is not allowed in this context")));
617 foreach(cell, options)
630 values[1] = (
Datum) 0;
702 for (opt = libpq_conninfo_options; opt->
optname; opt++)
729 foreach(cell, options_list)
743 for (opt = libpq_conninfo_options; opt->
optname; opt++)
749 (
errcode(ERRCODE_SYNTAX_ERROR),
751 errhint(
"Valid options in this context are: %s",
776 (
errcode(ERRCODE_UNDEFINED_OBJECT),
777 errmsg(
"foreign-data wrapper \"%s\" does not exist",
797 (
errcode(ERRCODE_UNDEFINED_OBJECT),
798 errmsg(
"server \"%s\" does not exist", servername)));
847 memcpy(hash_path, path,
sizeof(
HashPath));
856 memcpy(nest_path, path,
sizeof(
NestPath));
865 memcpy(merge_path, path,
sizeof(
MergePath));
908 return (
Path *) joinpath;
struct FdwRoutine * rd_fdwroutine
void tuplestore_putvalues(Tuplestorestate *state, TupleDesc tdesc, Datum *values, bool *isnull)
TupleDesc CreateTupleDescCopy(TupleDesc tupdesc)
#define IsA(nodeptr, _type_)
Oid GetUserMappingId(Oid userid, Oid serverid, bool missing_ok)
int errhint(const char *fmt,...)
static bool is_conninfo_option(const char *option, Oid context)
#define Anum_pg_user_mapping_umuser
#define Anum_pg_user_mapping_umserver
#define Anum_pg_foreign_server_srvversion
static HeapTuple find_user_mapping(Oid userid, Oid serverid, bool missing_ok)
#define PG_GETARG_DATUM(n)
#define DatumGetObjectId(X)
char * pstrdup(const char *in)
#define tuplestore_donestoring(state)
static MemoryContext MemoryContextSwitchTo(MemoryContext context)
ParamPathInfo * param_info
FdwRoutine * GetFdwRoutineByServerId(Oid serverid)
int errcode(int sqlerrcode)
ForeignTable * GetForeignTable(Oid relid)
Datum pg_options_to_table(PG_FUNCTION_ARGS)
#define OidIsValid(objectId)
static void deflist_to_tuplestore(ReturnSetInfo *rsinfo, List *options)
#define SearchSysCache1(cacheId, key1)
#define GetSysCacheOid1(cacheId, key1)
FdwRoutine * GetFdwRoutine(Oid fdwhandler)
Oid get_foreign_data_wrapper_oid(const char *fdwname, bool missing_ok)
ForeignDataWrapper * GetForeignDataWrapper(Oid fdwid)
List * GetForeignColumnOptions(Oid relid, AttrNumber attnum)
FormData_pg_foreign_table * Form_pg_foreign_table
void appendStringInfo(StringInfo str, const char *fmt,...)
#define ObjectIdGetDatum(X)
#define Anum_pg_user_mapping_umoptions
bool IsImportableForeignTable(const char *tablename, ImportForeignSchemaStmt *stmt)
#define CStringGetDatum(X)
ForeignServer * GetForeignServerByName(const char *srvname, bool missing_ok)
#define ereport(elevel, rest)
void initStringInfo(StringInfo str)
Tuplestorestate * tuplestore_begin_heap(bool randomAccess, bool interXact, int maxKBytes)
#define TextDatumGetCString(d)
#define Anum_pg_foreign_table_ftoptions
ForeignServer * GetForeignServer(Oid serverid)
#define PG_RETURN_BOOL(x)
FdwRoutine * GetFdwRoutineByRelId(Oid relid)
void ReleaseSysCache(HeapTuple tuple)
Datum SysCacheGetAttr(int cacheId, HeapTuple tup, AttrNumber attributeNumber, bool *isNull)
List * untransformRelOptions(Datum options)
FormData_pg_foreign_server * Form_pg_foreign_server
SetFunctionReturnMode returnMode
#define OidFunctionCall0(functionId)
#define ForeignServerRelationId
#define HeapTupleIsValid(tuple)
#define Assert(condition)
FormData_pg_foreign_data_wrapper * Form_pg_foreign_data_wrapper
ForeignDataWrapper * GetForeignDataWrapperByName(const char *fdwname, bool missing_ok)
Path * GetExistingLocalJoinPath(RelOptInfo *joinrel)
Oid GetForeignServerIdByRelId(Oid relid)
#define Anum_pg_foreign_server_srvtype
MemoryContext ecxt_per_query_memory
#define Anum_pg_attribute_attfdwoptions
Tuplestorestate * setResult
#define DatumGetPointer(X)
static Datum values[MAXATTR]
int errmsg(const char *fmt,...)
FdwRoutine * GetFdwRoutineForRelation(Relation relation, bool makecopy)
#define UserMappingRelationId
void * MemoryContextAlloc(MemoryContext context, Size size)
UserMapping * GetUserMappingById(Oid umid)
UserMapping * GetUserMapping(Oid userid, Oid serverid)
#define CStringGetTextDatum(s)
Datum postgresql_fdw_validator(PG_FUNCTION_ARGS)
#define HeapTupleGetOid(tuple)
#define Anum_pg_foreign_server_srvoptions
#define Anum_pg_foreign_data_wrapper_fdwoptions
#define RelationGetRelid(relation)
static struct ConnectionOption libpq_conninfo_options[]
Oid get_foreign_server_oid(const char *servername, bool missing_ok)
#define MappingUserName(userid)
MemoryContext CacheMemoryContext
ImportForeignSchemaType list_type
#define SearchSysCache2(cacheId, key1, key2)