Hello,
Beta2 crashes on restoring a dump of tsearch2-enabled database, as
produced by 8.2.x (x==5 IIRC) pg_dump; the shortest way I know to get
the SIG11:
SET search_path = public, pg_catalog;
CREATE TYPE tsvector;
CREATE FUNCTION tsvector_in(cstring) RETURNS tsvector AS '$libdir/tsearch2', 'tsvector_in' LANGUAGE c STRICT;
CREATE FUNCTION tsvector_out(tsvector) RETURNS cstring AS '$libdir/tsearch2', 'tsvector_out' LANGUAGE c
STRICT;
CREATE TYPE tsvector ( INTERNALLENGTH = variable, INPUT = tsvector_in, OUTPUT = tsvector_out,
ALIGNMENT= int4, STORAGE = extended );
select '42'::tsvector; -- dead
Logs:
postgres[32542]: [100-1] NOTICE: return type tsvector is only a shell postgres[32542]: [101-1] NOTICE: argument type
tsvectoris only a shell postgres[2794]: [98-1] LOG: server process (PID 32542) was terminated by signal 11:
Segmentationfault postgres[2794]: [99-1] LOG: terminating any other active server processes postgres[2794]: [100-1]
LOG: all server processes terminated; reinitializing postgres[32543]: [101-1] LOG: database system was interrupted;
lastknown up at 2007-11-01 22:18:33 GMT postgres[32543]: [102-1] LOG: database system was not properly shut down;
automaticrecovery in progress postgres[32543]: [103-1] LOG: redo starts at 0/35053E8 postgres[32543]: [104-1] LOG:
invalidmagic number 0000 in log file 0, segment 3, offset 5283840 postgres[32543]: [105-1] LOG: redo done at 0/3507FE4
postgres[32546]:[101-1] LOG: autovacuum launcher started postgres[2794]: [101-1] LOG: database system is ready to
acceptconnections
Database: encoding SQL_ASCII, locale C.
Top of the backtrace (postgres --single):
#0 0x08272e0b in gettoken_tsvector (state=0xbf8e5edc, strval=0x100, lenval=0x0, pos_ptr=0x2da00, poslen=0x842de50,
endptr=0x42b32ebb) at tsvector_parser.c:356 #1 0x42b1e16f in tsvector_in (fcinfo=0xbf8e5f2c) at tsvector.c:436 #2
0x08288b71in InputFunctionCall (flinfo=0x0, str=0x840ecc0 "42", typioparam=237587, typmod=-1) at fmgr.c:1835 #3
0x0828abdein OidInputFunctionCall (functionId=237588, str=0x840ecc0 "42", typioparam=237587, typmod=-1) at fmgr.c:1939
#4 0x08106f3b in stringTypeDatum (tp=0x42acf8c8, string=0x840ecc0 "42", atttypmod=-1) at parse_type.c:462 #5
0x081096dcin coerce_type (pstate=0x840ee78, node=0x840e890, inputTypeId=705, targetTypeId=237587, targetTypeMod=-1,
ccontext=COERCION_EXPLICIT, cformat=COERCE_EXPLICIT_CAST) at parse_coerce.c:210
Is contrib/tsearch2 obsolete?
I have noticed that the variables token, toklen, pos and poslen are not
initialized in src/backend/utils/adt/tsvector.c::tsvectorin() (and
contain automatic trash), but are written in (the RETURN_TOKEN macro at)
src/backend/utils/adt/tsvector_parser.c::gettoken_tsvector() if not
NULL... is this correct?
--
Radosław Zieliński <radek@pld-linux.org>