• R/O
  • HTTP
  • SSH
  • HTTPS

pg_hint_plan: コミット

firtst release


コミットメタ情報

リビジョン816040df7e7ee159007895743fec7e76f7f10e90 (tree)
日時2018-06-08 10:07:44
作者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
@@ -1803,6 +1803,21 @@ get_query_string(ParseState *pstate, Query *query, Query **jumblequery)
18031803 {
18041804 const char *p = debug_query_string;
18051805
1806+ /*
1807+ * If debug_query_string is set, it is the top level statement. But in some
1808+ * cases we reach here with debug_query_string set NULL for example in the
1809+ * case of DESCRIBE message handling. We may still see a candidate
1810+ * top-level query in pstate in the case.
1811+ */
1812+ if (!p)
1813+ {
1814+ /* We don't see a query string, return NULL */
1815+ if (!pstate->p_sourcetext)
1816+ return NULL;
1817+
1818+ p = pstate->p_sourcetext;
1819+ }
1820+
18061821 if (jumblequery != NULL)
18071822 *jumblequery = query;
18081823
旧リポジトリブラウザで表示