Opened 15 years ago

Closed 15 years ago

Last modified 12 years ago

#10647 closed (fixed)

Many-to-many tables are created even with managed=False

Reported by: Pavel Anossov Owned by: Jacob
Component: Database layer (models, ORM) Version: dev
Severity: Keywords: managed, manytomany
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: yes
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

What else can I say..
django.db.backends.creation.sql_for_many_to_many has no guards whatsoever.

    def sql_for_many_to_many(self, model, style):
        "Return the CREATE TABLE statments for all the many-to-many tables defined on a model"
        output = []
        for f in model._meta.local_many_to_many:
            output.extend(self.sql_for_many_to_many_field(model, f, style))
        return output

Attachments (2)

managedm2m.diff (594 bytes ) - added by Pavel Anossov 15 years ago.
patch
managedm2m_v2.diff (701 bytes ) - added by jbronn 15 years ago.
Omit ManyToMany table creation only if both fields are managed.

Download all attachments as: .zip

Change History (8)

by Pavel Anossov, 15 years ago

Attachment: managedm2m.diff added

patch

comment:1 by jbronn, 15 years ago

milestone: 1.1
Owner: changed from nobody to jbronn
Triage Stage: UnreviewedAccepted

comment:2 by jbronn, 15 years ago

Triage Stage: AcceptedDesign decision needed

by jbronn, 15 years ago

Attachment: managedm2m_v2.diff added

Omit ManyToMany table creation only if both fields are managed.

comment:3 by jbronn, 15 years ago

Needs documentation: set
Owner: changed from jbronn to Jacob
Triage Stage: Design decision neededAccepted

comment:4 by jbronn, 15 years ago

"In the face of ambiguity refuse the temptation to guess." In other words, we should only explicitly omit creation if both are unmanaged.

comment:5 by Jacob, 15 years ago

Resolution: fixed
Status: newclosed

(In [10455]) Fixed #10647: intermediary tables between two umanaged models are no longer created.

comment:6 by Jacob, 12 years ago

milestone: 1.1

Milestone 1.1 deleted

Note: See TracTickets for help on using tickets.
Back to Top