Skip site navigation (1) Skip section navigation (2)

Segfault with before triggers and after triggers with a WHEN clause.

From: Yoran Heling <info(at)yorhel(dot)nl>
To: pgsql-bugs(at)postgresql(dot)org
Subject: Segfault with before triggers and after triggers with a WHEN clause.
Date: 2011-08-21 12:00:55
Message-ID: CADL1CPghUq99wiKeAXja3oUBBma9ksiSQe3fR_b5fCa0nR3KXw@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-bugs
Hello,

After upgrading to PostgreSQL 9.0.4 (don't remember exactly where I
came from, but I believe it was an earlier 9.0.x), postgresql began to
segault on certain queries. I have managed to isolate the problem and
can reproduce the crash on a newly created and empty database with the
following queries:

CREATE TABLE some_t (some_col boolean NOT NULL);
CREATE OR REPLACE FUNCTION trig_before() RETURNS trigger AS $$
  BEGIN RETURN NEW; END;
$$ LANGUAGE plpgsql;
CREATE OR REPLACE FUNCTION trig_after() RETURNS trigger AS $$
  BEGIN RETURN NULL; END;
$$ LANGUAGE plpgsql;
CREATE TRIGGER trig_before BEFORE UPDATE ON some_t FOR EACH ROW
EXECUTE PROCEDURE trig_before();
CREATE TRIGGER trig_aftera  AFTER UPDATE ON some_t FOR EACH ROW WHEN
(NOT OLD.some_col AND NEW.some_col) EXECUTE PROCEDURE trig_after();
CREATE TRIGGER trig_afterb  AFTER UPDATE ON some_t FOR EACH ROW WHEN
(NOT NEW.some_col) EXECUTE PROCEDURE trig_after();
INSERT INTO some_t VALUES (TRUE);
UPDATE some_t SET some_col = TRUE;

This is on a 64bit Arch Linux system with the postgresql-9.0.4-4
package and a linux-3.0.1 kernel.

Here is a backtrace of the crash, although I suppose it might not be
very useful without debugging symbols:

#0  0x0000000000450dca in slot_getattr ()
#1  0x000000000054787c in ?? ()
#2  0x000000000054de11 in ExecQual ()
#3  0x000000000052dbf2 in ?? ()
#4  0x000000000052de9a in ?? ()
#5  0x0000000000532035 in ExecARUpdateTriggers ()
#6  0x000000000055b341 in ExecModifyTable ()
#7  0x0000000000547518 in ExecProcNode ()
#8  0x0000000000544d5a in standard_ExecutorRun ()
#9  0x00000000005fbf01 in ?? ()
#10 0x00000000005fc114 in ?? ()
#11 0x00000000005fccc2 in PortalRun ()
#12 0x00000000005f8f3c in PostgresMain ()
#13 0x00000000005c9ee8 in ?? ()
#14 0x00000000005ca7dc in PostmasterMain ()
#15 0x000000000044f397 in main ()

Responses

pgsql-bugs by date

Next:From: Hitoshi HaradaDate: 2011-08-21 16:44:37
Subject: BUG #6172: DROP EXTENSION error without CASCADE
Previous:From: Tom LaneDate: 2011-08-21 05:08:59
Subject: Re: BUG #6166: configure from source fails with 'This platform is not thread-safe.' but was actually /tmp perms

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group