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

trigger inheritance

From: "Horst Herb" <hherb(at)malleenet(dot)net(dot)au>
To: <pgsql-interfaces(at)hub(dot)org>
Cc: <pgsql-general(at)hub(dot)org>
Subject: trigger inheritance
Date: 2000-09-17 14:55:55
Message-ID: 004501c020b7$6cef4ce0$0100a8c0@hugin (view raw or flat)
Thread:
Lists: pgsql-generalpgsql-interfaces
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-interfaces by date

Next:From: Peter MountDate: 2000-09-18 10:44:12
Subject: RE: jdbc - prepared statement and cvs questions
Previous:From: Cesar A. K. GrossmannDate: 2000-09-16 18:12:07
Subject: PoPy?

pgsql-general by date

Next:From: K ParkerDate: 2000-09-17 16:42:44
Subject: Re: LOCK TABLE
Previous:From: Peter EisentrautDate: 2000-09-17 13:02:57
Subject: Re: libpq errors when makeing postgres 7.0.2...

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