• R/O
  • HTTP
  • SSH
  • HTTPS

pg_hint_plan: コミット

firtst release


コミットメタ情報

リビジョン2e0d63f90f4c25aaacf22e9b3795a4fe4e6f94b2 (tree)
日時2018-05-24 18:26:31
作者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
@@ -1795,6 +1795,21 @@ get_query_string(ParseState *pstate, Query *query, Query **jumblequery)
17951795 {
17961796 const char *p = debug_query_string;
17971797
1798+ /*
1799+ * If debug_query_string is set, it is the top level statement. But in some
1800+ * cases we reach here with debug_query_string set NULL for example in the
1801+ * case of DESCRIBE message handling. We may still see a candidate
1802+ * top-level query in pstate in the case.
1803+ */
1804+ if (!p)
1805+ {
1806+ /* We don't see a query string, return NULL */
1807+ if (!pstate->p_sourcetext)
1808+ return NULL;
1809+
1810+ p = pstate->p_sourcetext;
1811+ }
1812+
17981813 if (jumblequery != NULL)
17991814 *jumblequery = query;
18001815
旧リポジトリブラウザで表示