• R/O
  • HTTP
  • SSH
  • HTTPS

pg_hint_plan: コミット

firtst release


コミットメタ情報

リビジョン5c6296e97818f7b74bdce7aab84dc40d0bb38dc5 (tree)
日時2018-06-08 10:02:10
作者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
@@ -1659,6 +1659,21 @@ get_query_string(ParseState *pstate, Query *query, Query **jumblequery)
16591659 {
16601660 const char *p = debug_query_string;
16611661
1662+ /*
1663+ * If debug_query_string is set, it is the top level statement. But in some
1664+ * cases we reach here with debug_query_string set NULL for example in the
1665+ * case of DESCRIBE message handling. We may still see a candidate
1666+ * top-level query in pstate in the case.
1667+ */
1668+ if (!p)
1669+ {
1670+ /* We don't see a query string, return NULL */
1671+ if (!pstate->p_sourcetext)
1672+ return NULL;
1673+
1674+ p = pstate->p_sourcetext;
1675+ }
1676+
16621677 if (jumblequery != NULL)
16631678 *jumblequery = query;
16641679
旧リポジトリブラウザで表示