• 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

修訂c56520a41063c0403afc6ec972b0eabffc19668c (tree)
時間2018-05-24 18:18:29
作者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
@@ -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