If you have a many-to-one relationship, such as a contact list where
several people
share an address, you may want to delete the child record once the last
reference to
it is gone. I don't see how to implement a reference-counting scheme in
a database.
What's the right way to accomplish this?

Search Discussions

  • Stephan Szabo at Aug 9, 2003 at 10:11 pm

    On Sat, 9 Aug 2003, Jennifer Vargas wrote:

    If you have a many-to-one relationship, such as a contact list where
    several people
    share an address, you may want to delete the child record once the last
    reference to
    it is gone. I don't see how to implement a reference-counting scheme in
    a database.
    What's the right way to accomplish this?
    Probably a trigger on update or delete of the referencing table. If
    you're not worried about some of the multi-session concurrency problems,
    it's a marginally simple plpgsql trigger.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppgsql-novice @
categoriespostgresql
postedAug 9, '03 at 9:13p
activeAug 9, '03 at 10:11p
posts2
users2
websitepostgresql.org
irc#postgresql

2 users in discussion

Jennifer Vargas: 1 post Stephan Szabo: 1 post

People

Translate

site design / logo © 2022 Grokbase