From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | "Fendris" <f(dot)fendris(at)gmail(dot)com> |
Cc: | pgsql-bugs(at)postgresql(dot)org |
Subject: | Re: BUG #5111: Segmentation fault, if to_tsvector returns empty row to ts_stat |
Date: | 2009-10-13 14:23:45 |
Message-ID: | 27480.1255443825@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
"Fendris" <f(dot)fendris(at)gmail(dot)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
{
From | Date | Subject | |
---|---|---|---|
Next Message | Turner, Ian | 2009-10-13 15:32:18 | Re: Kerberos authentication, Active Directory, and PostgreSQL |
Previous Message | Yury Don | 2009-10-13 14:22:24 | BUG #5112: Segmentation fault on ts_stat with empty words |