Re: BUG #2594: Gin Indexes cause server to crash on Windows

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: cfis(at)savagexi(dot)com
Cc: pgsql-bugs(at)postgresql(dot)org, Teodor Sigaev <teodor(at)sigaev(dot)ru>
Subject: Re: BUG #2594: Gin Indexes cause server to crash on Windows
Date: 2006-08-29 13:44:55
Message-ID: 8267.1156859095@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

"Gin Indexes cause server to crash on Windows" <cfis(at)savagexi(dot)com> writes:
> CREATE TABLE test (
> vector tsvector NOT NULL
> );
> CREATE INDEX idx_test_vector ON test USING gin (vector);
> server closed the connection unexpectedly

It appears that building a gin index on an empty table fails on any
platform. I get a null pointer dereference with the following stack trace

(gdb) bt
#0 ginGetEntry (accum=0x7b03bc90, value=0x7b03bcd8, n=0x7b03bcdc)
at ginbulk.c:251
#1 0x15f994 in ginbuild (fcinfo=0x40104d80) at gininsert.c:316
#2 0x357a70 in OidFunctionCall3 (functionId=1074810240, arg1=1074604248,
arg2=1074631680, arg3=1074717032) at fmgr.c:1460
#3 0x17cb4c in index_build (heapRelation=0x400ee168,
indexRelation=0x400d9400, indexInfo=0x400ee168, isprimary=0 '\000')
at index.c:1281
#4 0x17c1a0 in index_create (heapRelationId=83433,
indexRelationName=0x400b1698 "idx_test_vector", indexRelationId=95941,
indexInfo=0x400ee168, accessMethodObjectId=2742, tableSpaceId=0,
classObjectId=0x400fa5b0, reloptions=0, isprimary=0, isconstraint=0,
allow_system_table_mods=0, skip_build=0 '\000', concurrent=0)
at index.c:782
#5 0x1d1da0 in DefineIndex (heapRelation=0x400b16d0,
indexRelationName=0x400b1698 "idx_test_vector", indexRelationId=0,
accessMethodName=0x400b1700 "gin", tableSpaceName=0x0,
attributeList=0x400b1768, predicate=0x0, rangetable=0x0, options=0x0,
unique=0 '\000', primary=0 '\000', isconstraint=0 '\000',
is_alter_table=0 '\000', check_rights=1, skip_build=0 '\000',
quiet=0 '\000', concurrent=0 '\000') at indexcmds.c:439

and

(gdb) p *accum
$1 = {ginstate = 0x7b03bc18, entries = 0x0, maxdepth = 1, stack = 0x40104d78,
stackpos = 0, allocatedMemory = 0, length = 1074717032, entryallocator = 0x0}

so it would seem that ginGetEntry() has overlooked the case that there
are no entries.

regards, tom lane

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2006-08-29 14:01:10 Re: Partially corrupted table
Previous Message Tino Schwarze 2006-08-29 13:40:01 Re: BUG #2592: ILIKE does not care about locales