Skip to content

FDW extension patch #7

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Ensure shippability info is cached per-server
  • Loading branch information
pramsey committed Oct 6, 2015
commit d77489f0ca7bec2c7c0f190dbbadd8cbf223d9b9
10 changes: 5 additions & 5 deletions contrib/postgres_fdw/deparse.c
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ foreign_expr_walker(Node *node,
* semantics on remote side.
*/
if (!is_builtin(fe->funcid) &&
!is_shippable(fe->funcid, ProcedureRelationId, fpinfo->extensions))
!is_shippable(fe->funcid, ProcedureRelationId, fpinfo->server, fpinfo->extensions))
return false;

/*
Expand Down Expand Up @@ -431,7 +431,7 @@ foreign_expr_walker(Node *node,
* too.)
*/
if (!is_builtin(oe->opno) &&
!is_shippable(oe->opno, OperatorRelationId, fpinfo->extensions))
!is_shippable(oe->opno, OperatorRelationId, fpinfo->server, fpinfo->extensions))
return false;

/*
Expand Down Expand Up @@ -472,7 +472,7 @@ foreign_expr_walker(Node *node,
* Again, only built-in operators can be sent to remote.
*/
if (!is_builtin(oe->opno) &&
!is_shippable(oe->opno, OperatorRelationId, fpinfo->extensions))
!is_shippable(oe->opno, OperatorRelationId, fpinfo->server, fpinfo->extensions))
return false;

/*
Expand Down Expand Up @@ -624,7 +624,7 @@ foreign_expr_walker(Node *node,
*/
if (check_type &&
!is_builtin(exprType(node)) &&
!is_shippable(exprType(node), TypeRelationId, fpinfo->extensions))
!is_shippable(exprType(node), TypeRelationId, fpinfo->server, fpinfo->extensions))
return false;

/*
Expand Down Expand Up @@ -1445,7 +1445,7 @@ deparseConst(Const *node, deparse_expr_cxt *context)
* but references to built-in types shouldn't be.
*/
appendStringInfo(buf, "::%s",
is_shippable(node->consttype, TypeRelationId, fpinfo->extensions) ?
is_shippable(node->consttype, TypeRelationId, fpinfo->server, fpinfo->extensions) ?
format_type_be_qualified(node->consttype) :
format_type_with_typemod(node->consttype, node->consttypmod));
}
Expand Down
2 changes: 1 addition & 1 deletion contrib/postgres_fdw/postgres_fdw.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ extern List *ExtractExtensionList(char *extensionString,
bool populateList);

/* in shippable.c */
extern bool is_shippable(Oid objnumber, Oid classnumber, List *extension_list);
extern bool is_shippable(Oid objnumber, Oid classnumber, ForeignServer *server, List *extension_list);

/* in deparse.c */
extern void classifyConditions(PlannerInfo *root,
Expand Down
4 changes: 3 additions & 1 deletion contrib/postgres_fdw/shippable.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ typedef struct
/* extension the object appears within, or InvalidOid if none */
Oid objid;
Oid classid;
Oid serverid;
} ShippableCacheKey;

typedef struct
Expand Down Expand Up @@ -152,7 +153,7 @@ lookup_shippable(Oid objnumber, Oid classnumber, List *extension_list)
* part of a declared extension if it is not cached.
*/
bool
is_shippable(Oid objnumber, Oid classnumber, List *extension_list)
is_shippable(Oid objnumber, Oid classnumber, ForeignServer *server, List *extension_list)
{
ShippableCacheKey key;
ShippableCacheEntry *entry;
Expand All @@ -170,6 +171,7 @@ is_shippable(Oid objnumber, Oid classnumber, List *extension_list)

key.objid = objnumber;
key.classid = classnumber;
key.serverid = server->serverid;

entry = (ShippableCacheEntry *)
hash_search(ShippableCacheHash,
Expand Down