#23554: Unmodified object fails to save because of UNIQUE constraint
-------------------------------+--------------------------------------
     Reporter:  tinloaf        |                    Owner:  nobody
         Type:  Bug            |                   Status:  new
    Component:  Uncategorized  |                  Version:  1.7
     Severity:  Normal         |               Resolution:
     Keywords:                 |             Triage Stage:  Unreviewed
    Has patch:  0              |      Needs documentation:  0
  Needs tests:  0              |  Patch needs improvement:  0
Easy pickings:  0              |                    UI/UX:  0
-------------------------------+--------------------------------------
Changes (by tinloaf):

 * needs_better_patch:   => 0
 * needs_tests:   => 0
 * needs_docs:   => 0


Comment:

 Got something: I looked at django.db.connection.queries. The first query
 is when it retrieves the mandates, the second one should be an UPDATE, but
 for some reason it's an INSERT. What's going on there?

 {{{
 >>> print(connection.queries)
 [
 {'time': '0.001', 'sql': 'QUERY = \'SELECT "finance_mandate"."id",
 "finance_mandate"."user_id", "finance_mandate"."holder",
 "finance_mandate"."street", "finance_mandate"."plz",
 "finance_mandate"."city", "finance_mandate"."country",
 "finance_mandate"."iban",
 "finance_mandate"."bic", "finance_mandate"."active",
 "finance_mandate"."revoked_on", "finance_mandate"."mandate_id" FROM
 "finance_mandate"
 LIMIT 1\' - PARAMS = ()'},

 {'time': '0.000', 'sql': "QUERY = 'BEGIN' - PARAMS = ()"}, {'time':
 '0.000', 'sql': 'QUERY = \'INSERT INTO
 "finance_mandate" ("id", "user_id", "holder", "street", "plz", "city",
 "country", "iban", "bic", "active", "revoked_on", "mandate_id")
 SELECT %s AS "id", %s AS "user_id", %s AS "holder", %s AS "street", %s AS
 "plz", %s AS "city", %s AS "country", %s AS "iban", %s AS "bic",
 %s AS "active", %s AS "revoked_on", %s AS "mandate_id"\' - PARAMS = (1, 2,
 \'...\', \'...\', ..., \'...\',
 \'Deutschland\', \'...\', \'...\', False, None, \'...\')'}]
 }}}

 (Replaced actual data with '...')

--
Ticket URL: <https://code.djangoproject.com/ticket/23554#comment:1>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/065.999144133e0ece02f1dcc6f9b21c666a%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to