• R/O
  • HTTP
  • SSH
  • HTTPS

提交

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

firtst release


Commit MetaInfo

修訂5c6296e97818f7b74bdce7aab84dc40d0bb38dc5 (tree)
時間2018-06-08 10:02:10
作者Kyotaro Horiguchi <horiguchi.kyotaro@lab....>
CommiterKyotaro Horiguchi

Log Message

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.

Change Summary

差異

--- 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