63 elog(
ERROR,
"cache lookup failed for foreign-data wrapper %u", fdwid);
71 fdw->
owner = fdwform->fdwowner;
79 Anum_pg_foreign_data_wrapper_fdwoptions,
137 elog(
ERROR,
"cache lookup failed for foreign server %u", serverid);
146 server->
owner = serverform->srvowner;
147 server->
fdwid = serverform->srvfdw;
152 Anum_pg_foreign_server_srvtype,
159 Anum_pg_foreign_server_srvversion,
166 Anum_pg_foreign_server_srvoptions,
225 (
errcode(ERRCODE_UNDEFINED_OBJECT),
226 errmsg(
"user mapping not found for user \"%s\", server \"%s\"",
238 Anum_pg_user_mapping_umoptions,
265 elog(
ERROR,
"cache lookup failed for foreign table %u", relid);
275 Anum_pg_foreign_table_ftoptions,
304 elog(
ERROR,
"cache lookup failed for attribute %d of relation %u",
308 Anum_pg_attribute_attfdwoptions,
336 (
errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
337 errmsg(
"access to non-system foreign table is restricted")));
344 elog(
ERROR,
"foreign-data wrapper handler function %u did not return an FdwRoutine struct",
364 elog(
ERROR,
"cache lookup failed for foreign table %u", relid);
366 serverid = tableform->ftserver;
389 elog(
ERROR,
"cache lookup failed for foreign server %u", serverid);
391 fdwid = serverform->srvfdw;
397 elog(
ERROR,
"cache lookup failed for foreign-data wrapper %u", fdwid);
399 fdwhandler = fdwform->fdwhandler;
404 (
errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
405 errmsg(
"foreign-data wrapper \"%s\" has no handler",
456 memcpy(cfdwroutine, fdwroutine,
sizeof(
FdwRoutine));
488 switch (
stmt->list_type)
494 foreach(lc,
stmt->table_list)
498 if (strcmp(tablename, rv->
relname) == 0)
504 foreach(lc,
stmt->table_list)
508 if (strcmp(tablename, rv->
relname) == 0)
577 {
"authtype", ForeignServerRelationId},
578 {
"service", ForeignServerRelationId},
579 {
"user", UserMappingRelationId},
580 {
"password", UserMappingRelationId},
581 {
"connect_timeout", ForeignServerRelationId},
582 {
"dbname", ForeignServerRelationId},
583 {
"host", ForeignServerRelationId},
584 {
"hostaddr", ForeignServerRelationId},
585 {
"port", ForeignServerRelationId},
586 {
"tty", ForeignServerRelationId},
587 {
"options", ForeignServerRelationId},
588 {
"requiressl", ForeignServerRelationId},
589 {
"sslmode", ForeignServerRelationId},
590 {
"gsslib", ForeignServerRelationId},
591 {
"gssdelegation", ForeignServerRelationId},
633 foreach(cell, options_list)
640 const char *closest_match;
642 bool has_valid_options =
false;
653 has_valid_options =
true;
660 (
errcode(ERRCODE_SYNTAX_ERROR),
662 has_valid_options ? closest_match ?
663 errhint(
"Perhaps you meant the option \"%s\".",
665 errhint(
"There are no valid options in this context.")));
687 Anum_pg_foreign_data_wrapper_oid,
691 (
errcode(ERRCODE_UNDEFINED_OBJECT),
692 errmsg(
"foreign-data wrapper \"%s\" does not exist",
713 (
errcode(ERRCODE_UNDEFINED_OBJECT),
714 errmsg(
"server \"%s\" does not exist", servername)));
754 if (path->param_info != NULL)
763 memcpy(hash_path, path,
sizeof(
HashPath));
772 memcpy(nest_path, path,
sizeof(
NestPath));
781 memcpy(merge_path, path,
sizeof(
MergePath));
815 if (joinpath->path.pathtype == T_MergeJoin)
841 if (joinpath->path.pathtype == T_MergeJoin)
857 return (
Path *) joinpath;
static Datum values[MAXATTR]
#define CStringGetTextDatum(s)
#define TextDatumGetCString(d)
#define OidIsValid(objectId)
int errhint(const char *fmt,...)
int errcode(int sqlerrcode)
int errmsg(const char *fmt,...)
#define ereport(elevel,...)
#define OidFunctionCall0(functionId)
#define PG_GETARG_DATUM(n)
#define PG_RETURN_BOOL(x)
static bool is_conninfo_option(const char *option, Oid context)
static const struct ConnectionOption libpq_conninfo_options[]
ForeignDataWrapper * GetForeignDataWrapper(Oid fdwid)
ForeignServer * GetForeignServerByName(const char *srvname, bool missing_ok)
FdwRoutine * GetFdwRoutineForRelation(Relation relation, bool makecopy)
FdwRoutine * GetFdwRoutineByServerId(Oid serverid)
ForeignTable * GetForeignTable(Oid relid)
Path * GetExistingLocalJoinPath(RelOptInfo *joinrel)
UserMapping * GetUserMapping(Oid userid, Oid serverid)
Oid get_foreign_server_oid(const char *servername, bool missing_ok)
ForeignServer * GetForeignServer(Oid serverid)
Datum pg_options_to_table(PG_FUNCTION_ARGS)
ForeignDataWrapper * GetForeignDataWrapperExtended(Oid fdwid, bits16 flags)
Datum postgresql_fdw_validator(PG_FUNCTION_ARGS)
FdwRoutine * GetFdwRoutineByRelId(Oid relid)
ForeignDataWrapper * GetForeignDataWrapperByName(const char *fdwname, bool missing_ok)
Oid GetForeignServerIdByRelId(Oid relid)
bool IsImportableForeignTable(const char *tablename, ImportForeignSchemaStmt *stmt)
ForeignServer * GetForeignServerExtended(Oid serverid, bits16 flags)
FdwRoutine * GetFdwRoutine(Oid fdwhandler)
List * GetForeignColumnOptions(Oid relid, AttrNumber attnum)
Oid get_foreign_data_wrapper_oid(const char *fdwname, bool missing_ok)
#define MappingUserName(userid)
void InitMaterializedSRF(FunctionCallInfo fcinfo, bits32 flags)
#define MAT_SRF_USE_EXPECTED_DESC
Assert(PointerIsAligned(start, uint64))
#define HeapTupleIsValid(tuple)
static void * GETSTRUCT(const HeapTupleData *tuple)
struct parser_state match_state[5]
if(TABLE==NULL||TABLE_index==NULL)
void * MemoryContextAlloc(MemoryContext context, Size size)
char * pstrdup(const char *in)
MemoryContext CacheMemoryContext
#define IsA(nodeptr, _type_)
@ FDW_IMPORT_SCHEMA_LIMIT_TO
@ FDW_IMPORT_SCHEMA_EXCEPT
bool pathkeys_count_contained_in(List *keys1, List *keys2, int *n_common)
bool pathkeys_contained_in(List *keys1, List *keys2)
FormData_pg_foreign_data_wrapper * Form_pg_foreign_data_wrapper
FormData_pg_foreign_server * Form_pg_foreign_server
FormData_pg_foreign_table * Form_pg_foreign_table
FormData_pg_user_mapping * Form_pg_user_mapping
int restrict_nonsystem_relation_kind
static Datum Int16GetDatum(int16 X)
static Datum ObjectIdGetDatum(Oid X)
static Pointer DatumGetPointer(Datum X)
static Datum CStringGetDatum(const char *X)
#define RelationGetRelid(relation)
List * untransformRelOptions(Datum options)
struct FdwRoutine * rd_fdwroutine
Tuplestorestate * setResult
void ReleaseSysCache(HeapTuple tuple)
HeapTuple SearchSysCache1(int cacheId, Datum key1)
Datum SysCacheGetAttr(int cacheId, HeapTuple tup, AttrNumber attributeNumber, bool *isNull)
HeapTuple SearchSysCache2(int cacheId, Datum key1, Datum key2)
#define GetSysCacheOid1(cacheId, oidcol, key1)
#define RESTRICT_RELKIND_FOREIGN_TABLE
void tuplestore_putvalues(Tuplestorestate *state, TupleDesc tdesc, const Datum *values, const bool *isnull)
const char * getClosestMatch(ClosestMatchState *state)
void initClosestMatch(ClosestMatchState *state, const char *source, int max_d)
void updateClosestMatch(ClosestMatchState *state, const char *candidate)