• R/O
  • HTTP
  • SSH
  • HTTPS

pg_hint_plan: コミット

firtst release


コミットメタ情報

リビジョン6cec5f7c2e867197d0786fe298588ceb114ab4bd (tree)
日時2018-06-08 10:03:33
作者Kyotaro Horiguchi <horiguchi.kyotaro@lab....>
コミッターKyotaro Horiguchi

ログメッセージ

Fix a crash bug in case debug_query_string is NULL

pg_hint_plan believed that debug_query_string cannot be null when
parse_analyze is called, but for example in the case under
exec_describe_statement_message, it is not. We see the query string in
pstate even in the case, so use it instead in the case. Since pstate
is storing the query of the lowermost level, we should use
debug_query_string in other cases.

変更サマリ

差分

--- a/pg_hint_plan.c
+++ b/pg_hint_plan.c
@@ -1668,6 +1668,21 @@ get_query_string(ParseState *pstate, Query *query, Query **jumblequery)
16681668 {
16691669 const char *p = debug_query_string;
16701670
1671+ /*
1672+ * If debug_query_string is set, it is the top level statement. But in some
1673+ * cases we reach here with debug_query_string set NULL for example in the
1674+ * case of DESCRIBE message handling. We may still see a candidate
1675+ * top-level query in pstate in the case.
1676+ */
1677+ if (!p)
1678+ {
1679+ /* We don't see a query string, return NULL */
1680+ if (!pstate->p_sourcetext)
1681+ return NULL;
1682+
1683+ p = pstate->p_sourcetext;
1684+ }
1685+
16711686 if (jumblequery != NULL)
16721687 *jumblequery = query;
16731688
旧リポジトリブラウザで表示