Re: *Proper* solution for 1..* relationship?
От
David Johnston
Тема
Re: *Proper* solution for 1..* relationship?
Дата
Msg-id
1366980905007-5753392.post@n5.nabble.com
Ответ на
*Proper* solution for 1..* relationship? (Wolfgang Keller)
Список
Дерево обсуждения
*Proper* solution for 1..* relationship? Wolfgang Keller <feliphil@gmx.net>
Re: *Proper* solution for 1..* relationship? David Johnston <polobo@yahoo.com>
Re: *Proper* solution for 1..* relationship? Kevin Grittner <kgrittn@ymail.com>
Re: *Proper* solution for 1..* relationship? Wolfgang Keller <feliphil@gmx.net>
Re: *Proper* solution for 1..* relationship? David Johnston <polobo@yahoo.com>
Re: *Proper* solution for 1..* relationship? Wolfgang Keller <feliphil@gmx.net>
Re: *Proper* solution for 1..* relationship? David Johnston <polobo@yahoo.com>
Re: *Proper* solution for 1..* relationship? Kevin Grittner <kgrittn@ymail.com>
Re: *Proper* solution for 1..* relationship? David Johnston <polobo@yahoo.com>
Re: *Proper* solution for 1..* relationship? Richard Broersma <richard.broersma@gmail.com>
Re: *Proper* solution for 1..* relationship? Simon Riggs <simon@2ndQuadrant.com>
Re: *Proper* solution for 1..* relationship? Josh Kupershmidt <schmiddy@gmail.com>
Re: *Proper* solution for 1..* relationship? Gavin Flower <GavinFlower@archidevsys.co.nz>
Re: *Proper* solution for 1..* relationship? Richard Broersma <richard.broersma@gmail.com>
Re: *Proper* solution for 1..* relationship? Wolfgang Keller <feliphil@gmx.net>
Wolfgang Keller-2 wrote > It hit me today that a 1..* relationship can't be implemented just by a > single foreign key constraint. I must have been sleeping very deeply not > to notice this. > > E.g. there is a table "list" and another table "list_item" and the > relationship can be described as "every list has at least one > list_item" (and every list_item can only be part of one list, but > this is trivial). Change the cardinality to "0..*" ? If you want to enforce a view of the data the ensures "1..*" (for list) then create a view of "list" where only those entries with values in "list_item" are shown. Alternately you might simply add a counter column to the list table and use triggers to increment/decrement the "item_count". David J. -- View this message in context: http://postgresql.1045698.n5.nabble.com/Proper-solution-for-1-relationship-tp5753384p5753392.html Sent from the PostgreSQL - novice mailing list archive at Nabble.com.
В списке pgsql-novice по дате отправления