SPI_connectによって作成されたコンテキスト内で、pallocでメモリを割り当てても
SPI_finishで接続が切断された時に解放され使用することができなくなってしまう。
SPI_pallocだと上位のコンテキスト内にメモリを割り当ててくれる。
hints = pstrdup(SPI_getvalue(SPI_tuptable->vals[0],
SPI_tuptable->tupdesc, 1));
-
len = strlen(hints);
- buf = palloc(len + 1);
+ buf = SPI_palloc(len + 1);
memcpy(buf, hints, len);
buf[len] = '\0';
hints = buf;
* XXX: use something instead of debug_query_string?
*/
hints = get_hints_from_table(query, application_name);
- elog(LOG,
+ elog(DEBUG1,
"pg_hint_plan: get_hints_from_table [%s][%s]=>[%s]",
query, application_name,
hints ? hints : "(none)");