469,647 Members | 1,711 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,647 developers. It's quick & easy.

inheritance of triggers (OO tables)


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
1 2167
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.

Similar topics

1 post views Thread by Christopher Benson-Manica | last post: by
3 posts views Thread by Nagib Abi Fadel | last post: by
1 post views Thread by Jim McNeely | last post: by
6 posts views Thread by Brendan Jurd | last post: by
1 post views Thread by felix-lists-pgsql | last post: by
1 post views Thread by Ruediger Herrmann | last post: by
4 posts views Thread by --CELKO-- | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.