BUG #5069: Segfault

From: "Kenaniah Cerny" <kenaniah(at)gmail(dot)com>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #5069: Segfault
Date: 2009-09-20 07:34:40
Message-ID: 200909200734.n8K7YeFs088194@wwwmaster.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs


The following bug has been logged online:

Bug reference: 5069
Logged by: Kenaniah Cerny
Email address: kenaniah(at)gmail(dot)com
PostgreSQL version: 8.4.1
Operating system: Centos5.2
Description: Segfault
Details:

Segfault party!!!!

output of uname -a:
Linux <myhostname> 2.6.18-92.1.10.el5 #1 SMP Tue Aug 5 07:41:53 EDT 2008
i686 athlon i386 GNU/Linux

Fortunately due to an incremental update, I've narrowed the cause of the bug
down to the following function run as a trigger:

CREATE OR REPLACE FUNCTION "public"."trigger_update_words" () RETURNS
trigger AS
$body$
BEGIN
INSERT INTO words SELECT word FROM ts_stat('SELECT to_tsvector(''simple'',
name) FROM '||TG_TABLE_NAME||' WHERE title_type_id IN (1, 2, 4, 6) AND id =
'||NEW.id)
EXCEPT SELECT word FROM words;
RETURN NEW;
END;
$body$
LANGUAGE 'plpgsql'
VOLATILE
CALLED ON NULL INPUT
SECURITY INVOKER
COST 100;

CREATE TRIGGER "anime_titles_tr_update_words" AFTER INSERT OR UPDATE
ON "public"."anime_titles" FOR EACH ROW
EXECUTE PROCEDURE "public"."trigger_update_words"();

My anime titles relation is defined below:

CREATE TABLE "public"."anime_titles" (
"id" SERIAL,
"name" TEXT NOT NULL,
"anime_id" INTEGER NOT NULL,
"title_type_id" INTEGER NOT NULL,
"is_main" BOOLEAN DEFAULT false NOT NULL,
"metaphone" TEXT,
"metaphone_alt" TEXT,
CONSTRAINT "anime_titles_pkey" PRIMARY KEY("id"),
CONSTRAINT "anime_titles_fk_anime_id" FOREIGN KEY ("anime_id")
REFERENCES "public"."anime"("id")
ON DELETE CASCADE
ON UPDATE NO ACTION
NOT DEFERRABLE,
CONSTRAINT "anime_titles_fk_title_type_id" FOREIGN KEY ("title_type_id")
REFERENCES "public"."anime_title_types"("id")
ON DELETE NO ACTION
ON UPDATE NO ACTION
NOT DEFERRABLE
) WITH OIDS;

CREATE INDEX "anime_titles_idx_lower_name" ON "public"."anime_titles"
USING btree ((lower(name)))
TABLESPACE "second_disk";

CREATE INDEX "anime_titles_idx_metaphone" ON "public"."anime_titles"
USING btree ("metaphone", "metaphone_alt");

CREATE INDEX "anime_titles_idx_name_simple_text" ON "public"."anime_titles"
USING gin ((to_tsvector('simple'::regconfig, name)));

CREATE INDEX "anime_titles_idx_title_type_id" ON "public"."anime_titles"
USING btree ("title_type_id");

CREATE TRIGGER "anime_titles_tr_audit" AFTER INSERT OR UPDATE
ON "public"."anime_titles" FOR EACH ROW
EXECUTE PROCEDURE "public"."anime_titles_audit"();

CREATE TRIGGER "anime_titles_tr_update_metaphone" AFTER INSERT OR UPDATE
ON "public"."anime_titles" FOR EACH ROW
EXECUTE PROCEDURE "public"."update_metaphone_fields"();

CREATE TRIGGER "anime_titles_tr_update_words" AFTER INSERT OR UPDATE
ON "public"."anime_titles" FOR EACH ROW
EXECUTE PROCEDURE "public"."trigger_update_words"();

And last but not least, the words table:

CREATE TABLE "public"."words" (
"word" TEXT NOT NULL,
CONSTRAINT "words_pkey" PRIMARY KEY("word")
) WITH OIDS;

My database locale/collation/encoding is all en_US.UTF-8

I have concluded that the other two triggers that run on my anime_titles
table aren't related to the issue at hand as the issue still occurs with
those triggers disabled.

The segfault occurred when attempting to insert into anime_title a name of
'.hack//SIGN'

There are currently 5569 entries in the words table and 6928 entries in the
anime_titles table.

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2009-09-20 15:14:03 Re: BUG #5069: Segfault
Previous Message Peter Eisentraut 2009-09-20 07:08:39 Re: BUG #5068: LIKE