trigger inheritance - Mailing list pgsql-general

From Horst Herb
Subject trigger inheritance
Date
Msg-id 004501c020b7$6cef4ce0$0100a8c0@hugin
Whole thread Raw
List pgsql-general
In Postgres, is it possible to write a (trigger) function for a table "parent" that is inherited automatically by
tables"children" ? 

If so, how?

And how would this trigger function access _all_ columns in the table "children"?

Example:

create table parent (
    id serial,
    crc32 int4
);

create function calculate_crc()
returns opaque
as 'BEGIN
    new.crc32 = my_external_crc_func();
    -- my_external_crc_func must be able to "see" all columns of "new"
END;'
language 'plpgsql';

CREATE TRIGGER inherited
BEFORE INSERT OR UPDATE
ON parent
FOR EACH ROW
EXECUTE PROCEDURE calculate_crc();


create table child (
    something text
) inherits (parent);


When I try this, "child" does not seem to inherit the trigger. What's more - I don't know how to let
"my_external_crc_func"(loaded dynamically) can "see" all columns in "child". 

Who can help me?

Most thankful for any hints,
Horst


pgsql-general by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: Problems buidling PostgreSQL v7.0.2 on Solaris 2.5.1
Next
From: "K Parker"
Date:
Subject: Re: LOCK TABLE