OSDN Git Service

Fix bug #0011, which crushes server on repeated Set hint failures.
authorShigeru HANADA <shigeru.hanada@gmail.com>
Mon, 27 Aug 2012 06:27:24 +0000 (15:27 +0900)
committerShigeru HANADA <shigeru.hanada@gmail.com>
Mon, 27 Aug 2012 06:40:38 +0000 (15:40 +0900)
Old implementation copies ErrorData and calls ereport again, but doesn't
flush error state at all.  This sequence causes ErrorData stack overflow
and PostgreSQL panics in such situation.

pg_hint_plan.c

index 2145d3a..a75426c 100644 (file)
@@ -1309,6 +1309,7 @@ set_config_option_wrapper(const char *name, const char *value,
 
                ecxt = MemoryContextSwitchTo(ccxt);
                errdata = CopyErrorData();
+               FlushErrorState();
                ereport(elevel, (errcode(errdata->sqlerrcode),
                                errmsg("%s", errdata->message),
                                errdata->detail ? errdetail("%s", errdata->detail) : 0,