Skip to content

Commit e35c1dc

Browse files
committed
Rename extern function is_foreign_expr() to mysql_is_foreign_expr().
postgres_fdw has the same-named extern function. So if we have both the extensions installed, then we have observed some weird behavior i.e. sometimes for MySQL server query, postgres_fdw's is_foreign_expr() is getting called, leading to a server crash. So rename it by appending "mysql_" to the function name. Suraj Kharage, reviewed by Vaibhav Dalvi.
1 parent 321199e commit e35c1dc

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

deparse.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1712,7 +1712,7 @@ foreign_expr_walker(Node *node, foreign_glob_cxt *glob_cxt,
17121712
* Returns true if given expr is safe to evaluate on the foreign server.
17131713
*/
17141714
bool
1715-
is_foreign_expr(PlannerInfo *root, RelOptInfo *baserel, Expr *expr)
1715+
mysql_is_foreign_expr(PlannerInfo *root, RelOptInfo *baserel, Expr *expr)
17161716
{
17171717
foreign_glob_cxt glob_cxt;
17181718
foreign_loc_cxt loc_cxt;

mysql_fdw.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -776,7 +776,7 @@ mysqlGetForeignRelSize(PlannerInfo *root, RelOptInfo *baserel,
776776
{
777777
RestrictInfo *ri = (RestrictInfo *) lfirst(lc);
778778

779-
if (is_foreign_expr(root, baserel, ri->clause))
779+
if (mysql_is_foreign_expr(root, baserel, ri->clause))
780780
fpinfo->remote_conds = lappend(fpinfo->remote_conds, ri);
781781
else
782782
fpinfo->local_conds = lappend(fpinfo->local_conds, ri);
@@ -1045,7 +1045,7 @@ mysqlGetForeignPlan(PlannerInfo *root, RelOptInfo *foreignrel,
10451045
}
10461046
else if (list_member_ptr(fpinfo->local_conds, rinfo))
10471047
local_exprs = lappend(local_exprs, rinfo->clause);
1048-
else if (is_foreign_expr(root, foreignrel, rinfo->clause))
1048+
else if (mysql_is_foreign_expr(root, foreignrel, rinfo->clause))
10491049
{
10501050
remote_conds = lappend(remote_conds, rinfo);
10511051
remote_exprs = lappend(remote_exprs, rinfo->clause);

mysql_fdw.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,6 @@ typedef struct MySQLColumn
161161
int atttype; /* Attribute type */
162162
} MySQLColumn;
163163

164-
extern bool is_foreign_expr(PlannerInfo *root, RelOptInfo *baserel,
165-
Expr *expr);
166164

167165
extern int ((mysql_options) (MYSQL *mysql, enum mysql_option option,
168166
const void *arg));
@@ -229,6 +227,8 @@ extern void mysql_append_where_clause(StringInfo buf, PlannerInfo *root,
229227
RelOptInfo *baserel, List *exprs,
230228
bool is_first, List **params);
231229
extern void mysql_deparse_analyze(StringInfo buf, char *dbname, char *relname);
230+
extern bool mysql_is_foreign_expr(PlannerInfo *root, RelOptInfo *baserel,
231+
Expr *expr);
232232

233233

234234
/* connection.c headers */

0 commit comments

Comments
 (0)