"Fendris" <f.fend...@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
        {

-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs

Reply via email to