• R/O
  • HTTP
  • SSH
  • HTTPS

pg_hint_plan: コミット

firtst release


コミットメタ情報

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