Permalink
Browse files

Display the MySQL query as part of the additional EXPLAIN info.

  • Loading branch information...
1 parent 81dff10 commit ab9b1942ea07e026494fc533ba45d2ab25c9df17 @dpage dpage committed Aug 1, 2011
Showing with 3 additions and 0 deletions.
  1. +3 −0 mysql_fdw.c
View
@@ -466,6 +466,8 @@ mysqlExplainForeignScan(ForeignScanState *node, ExplainState *es)
char *svr_query = NULL;
char *svr_table = NULL;
+ MySQLFdwExecutionState *festate = (MySQLFdwExecutionState *) node->fdw_state;
+
/* Fetch options */
mysqlGetOptions(RelationGetRelid(node->ss.ss_currentRelation), &svr_address, &svr_port, &svr_username, &svr_password, &svr_database, &svr_query, &svr_table);
@@ -476,6 +478,7 @@ mysqlExplainForeignScan(ForeignScanState *node, ExplainState *es)
ExplainPropertyLong("Local server startup cost", 10, es);
else
ExplainPropertyLong("Remote server startup cost", 25, es);
+ ExplainPropertyText("MySQL query", festate->query, es);
}
}

0 comments on commit ab9b194

Please sign in to comment.