Re: BUG #5111: Segmentation fault, if to_tsvector returns empty row to ts_stat
От | Tom Lane |
---|---|
Тема | Re: BUG #5111: Segmentation fault, if to_tsvector returns empty row to ts_stat |
Дата | |
Msg-id | 27480.1255443825@sss.pgh.pa.us обсуждение исходный текст |
Ответ на | BUG #5111: Segmentation fault, if to_tsvector returns empty row to ts_stat ("Fendris" <f.fendris@gmail.com>) |
Список | pgsql-bugs |
"Fendris" <f.fendris@gmail.com> writes: > SELECT * from ts_stat('SELECT to_tsvector(''simple'','''')'); > [ dumps core ] Thanks, looks like this code just missed the possibility of an empty tree. Attached patch fixes it. regards, tom lane *** src/backend/utils/adt/tsvector_op.c.orig Thu Jul 16 02:33:44 2009 --- src/backend/utils/adt/tsvector_op.c Tue Oct 13 10:19:24 2009 *************** *** 959,975 **** node = stat->root; /* find leftmost value */ ! for (;;) ! { ! stat->stack[stat->stackpos] = node; ! if (node->left) { ! stat->stackpos++; ! node = node->left; } ! else ! break; ! } tupdesc = CreateTemplateTupleDesc(3, false); TupleDescInitEntry(tupdesc, (AttrNumber) 1, "word", --- 959,979 ---- node = stat->root; /* find leftmost value */ ! if (node == NULL) ! stat->stack[stat->stackpos] = NULL; ! else ! for (;;) { ! stat->stack[stat->stackpos] = node; ! if (node->left) ! { ! stat->stackpos++; ! node = node->left; ! } ! else ! break; } ! Assert(stat->stackpos <= stat->maxdepth); tupdesc = CreateTemplateTupleDesc(3, false); TupleDescInitEntry(tupdesc, (AttrNumber) 1, "word", *************** *** 1015,1020 **** --- 1019,1025 ---- else break; } + Assert(stat->stackpos <= stat->maxdepth); } else {
В списке pgsql-bugs по дате отправления: