On Tuesday 07 April 2009 05:52:22 Richard Smith wrote (edited to correct top-posting):
> On Mon, Apr 6, 2009 at 6:15 PM, Malcolm Tredinnick wrote: > > > > On Mon, 2009-04-06 at 04:53 -0700, Adys wrote: > > > I made a small patch for my local Django install to be able to precise > > > add_constraint=False (default True, normal behaviour) to FKeys/ > > > M2Ms/... > > > As the tin says, it prevents index/constraint creation for that field. > > > I won't bother going through the use cases for this; I know I need it > > > and maybe other people too. > > > > No, actually the only way something like this is ever going to get into > > Django is precisely because there are compelling use-cases. > > what would the use cases be? > Django relation fields provide two sets of functionalities. One is the definition of referring columns and the accompanying constraints (and perhaps indexes); the other is the use of the referring columns in joins, to fetch related records from the database. It may seem logical to separate the two in some instances. However, I have yet to see the case where the wish for such separation is not the result of a database design mistake. I have run into one example case, where historic (versioned) data was involved. As SQL support for history of records is nothing to write home about, mistakes (from a true-relational, theoretic viewpoint) are almost inevitable; you are forced to choose between evils. However, since Django is higher-level, I think the solution, even in such cases, should be with a better abstraction of what you try to achieve, rather than introducing breakage into foreign keys; generic foreign keys may be a model for such higher abstractions. My 2 cents, Shai. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@googlegroups.com To unsubscribe from this group, send email to django-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-developers?hl=en -~----------~----~----~----~------~----~------~--~---