Thread: Bug 3883 revisited

Bug 3883 revisited

From
"Heikki Linnakangas"
Date:
The "TRUNCATE table while we're holding references to it" bug (3883), is 
causing an assertion failure on 8.2, when the TRUNCATE is called in a 
trigger:

Script:

CREATE TABLE proc(n int);
INSERT INTO proc VALUES (9);

CREATE OR REPLACE FUNCTION deltrig() RETURNS trigger LANGUAGE plpgsql AS $$
BEGIN  EXECUTE 'TRUNCATE TABLE proc';  RETURN OLD;
end;
$$;

CREATE TRIGGER trg_proc BEFORE DELETE ON PROC FOR EACH ROW EXECUTE 
PROCEDURE deltrig();

DELETE FROM proc WHERE n=9;


Error message:

TRAP: FailedAssertion("!(( ((void) ((bool) ((! assert_enabled) || ! 
(!(((void*)(lp) != ((void *)0)))) || 
(ExceptionalCondition("!(((void*)(lp) != ((void *)0)))", 
("FailedAssertion"), "heapam.c", 1595))))), (bool) (((lp)->lp_flags & 
0x01) != 0) ))", File: "heapam.c", Line: 1595)

With assertions disabled, you get an "attempted to delete invisible 
tuple" error, but it seems like good luck that it doesn't lead to a crash.

I think we need to backpatch the fix for this...

--   Heikki Linnakangas  EnterpriseDB   http://www.enterprisedb.com


Re: Bug 3883 revisited

From
Alvaro Herrera
Date:
Heikki Linnakangas wrote:
> The "TRUNCATE table while we're holding references to it" bug (3883), is  
> causing an assertion failure on 8.2, when the TRUNCATE is called in a  
> trigger:

[...]

> I think we need to backpatch the fix for this...

So, what's the patch that needs the be backpatched?

-- 
Alvaro Herrera                                http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support


Re: Bug 3883 revisited

From
Tom Lane
Date:
"Heikki Linnakangas" <heikki@enterprisedb.com> writes:
> The "TRUNCATE table while we're holding references to it" bug (3883), is 
> causing an assertion failure on 8.2, when the TRUNCATE is called in a 
> trigger:
> ...
> I think we need to backpatch the fix for this...

Yeah, I'll see about doing that.  I'd been hesitant to back-patch an
unproven fix, but since the patch went out in 8.3.0 and 8.3.1 and
we've not seen any trouble reports, I feel better about it now.
        regards, tom lane