inheritance of triggers (OO tables)

Started by Christoph Grafabout 22 years ago2 messagesgeneral
Jump to latest
#1Christoph Graf
christoph.graf@chello.at

Hi everybody!

As far as I have seen you can inherit from a table and get its columns.
Is there a possibility to also inherit a tables triggers? When I simply
derive a table from another I don't get them (-> they don't trigger). It
there is a way please tell me how I do this (and where I can find more
information about writing triggers in a OO sense - e.g. depending on
which table actually triggers, ...), if not where can I find information
about postgres object-orientation policy (if they plan to implement such
things, how they handle OO)?

Yours,

Christoph Graf

#2Scott Goodwin
scott@scottg.net
In reply to: Christoph Graf (#1)
Re: inheritance of triggers (OO tables)

Inherited tables only inherit column characteristics, not constraints,
triggers etc. It's possible to insert values into a ChildTable that
violate unique or primary key constraints in an inherited ParentTable.
To prevent this you'd need an insert trigger on every child table that
checks to ensure values you're inserting don't violate those
constraints. Another problem is that you can't reference ParentTable
columns through the ChildTable, and they don't seem to work when you
reference them in the ParentTable either. I'd do an insert into the
ChildTable which would make the column value "show up" in the
ParentTable's primary key column, but column references didn't work
into the ParentTable for the values that were inserted this way.

Inheritance needs more development before it works in a way you'd
expect.

/s.

On Feb 28, 2004, at 7:03 PM, Christoph Graf wrote:

Show quoted text

Hi everybody!

As far as I have seen you can inherit from a table and get its columns.
Is there a possibility to also inherit a tables triggers? When I simply
derive a table from another I don't get them (-> they don't trigger).
It
there is a way please tell me how I do this (and where I can find more
information about writing triggers in a OO sense - e.g. depending on
which table actually triggers, ...), if not where can I find
information
about postgres object-orientation policy (if they plan to implement
such
things, how they handle OO)?

Yours,

Christoph Graf

---------------------------(end of
broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to
majordomo@postgresql.org