By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,836 Members | 2,097 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,836 IT Pros & Developers. It's quick & easy.

inheritance of triggers (OO tables)

P: n/a

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 ma*******@postgresql.org

Nov 23 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
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:

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
ma*******@postgresql.org

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html

Nov 23 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.