Beta2 crash / create type + tsearch2

Started by Radoslaw Zielinskiabout 18 years ago4 messages
#1Radoslaw Zielinski
radek@pld-linux.org

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 tsvector is only a shell
postgres[2794]: [98-1] LOG: server process (PID 32542) was terminated by signal 11: Segmentation fault
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; last known up at 2007-11-01 22:18:33 GMT
postgres[32543]: [102-1] LOG: database system was not properly shut down; automatic recovery in progress
postgres[32543]: [103-1] LOG: redo starts at 0/35053E8
postgres[32543]: [104-1] LOG: invalid magic 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 accept connections

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 0x08288b71 in InputFunctionCall (flinfo=0x0, str=0x840ecc0 "42", typioparam=237587, typmod=-1) at fmgr.c:1835
#3 0x0828abde in 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 0x081096dc in 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>

#2Jeff Davis
pgsql@j-davis.com
In reply to: Radoslaw Zielinski (#1)
Re: Beta2 crash / create type + tsearch2

On Tue, 2007-11-06 at 23:00 +0000, Radoslaw Zielinski wrote:

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:

Here is a guide to help migrate tsearch2 data from 8.2 to 8.3:

http://developer.postgresql.org/pgdocs/postgres/textsearch-
migration.html

It still needs some work. Here's a link to the 8.3 open items:

http://momjian.us/cgi-bin/pgpatches

I agree that a dump/restore from 8.2 with tsearch2 to 8.3 with built-in
tsearch should not SIGSEGV.

Thanks for testing the beta!

Regards,
Jeff Davis

#3Tom Lane
tgl@sss.pgh.pa.us
In reply to: Jeff Davis (#2)
Re: Beta2 crash / create type + tsearch2

Jeff Davis <pgsql@j-davis.com> writes:

I agree that a dump/restore from 8.2 with tsearch2 to 8.3 with built-in
tsearch should not SIGSEGV.

That's not what he did, though. Force-feeding contrib/tsearch2 into 8.3
will not work.

regards, tom lane

#4Radoslaw Zielinski
radek@pld-linux.org
In reply to: Tom Lane (#3)
Re: Beta2 crash / create type + tsearch2

Tom Lane <tgl@sss.pgh.pa.us> [07-11-2007 05:24]:

Jeff Davis <pgsql@j-davis.com> writes:

I agree that a dump/restore from 8.2 with tsearch2 to 8.3 with built-in
tsearch should not SIGSEGV.

That's not what he did, though. Force-feeding contrib/tsearch2 into 8.3
will not work.

That is what I did. It's dump what has generated these commands, not
my ideas.

Note: I don't have a problem with editing the dump if that's what is
needed.

cvs rm ...?

--
Radosław Zieliński <radek@pld-linux.org>