[Django] #29126: Model.update_or_create method pk issue.

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

[Django] #29126: Model.update_or_create method pk issue.

Django
#29126: Model.update_or_create method pk issue.
-------------------------------------+-------------------------------------
               Reporter:  Théo       |          Owner:  nobody
  "Bob" Massard                      |
                   Type:  Bug        |         Status:  new
              Component:  Database   |        Version:  2.0
  layer (models, ORM)                |
               Severity:  Normal     |       Keywords:
           Triage Stage:             |      Has patch:  0
  Unreviewed                         |
    Needs documentation:  0          |    Needs tests:  0
Patch needs improvement:  0          |  Easy pickings:  0
                  UI/UX:  0          |
-------------------------------------+-------------------------------------
 Upon using the `update_or_create` method on a Model which has a modified
 `pk` field, an IntegrityError happens.

 `psycopg2.IntegrityError: duplicate key value violates unique constraint
 "tags_pkey"`

 The PrimaryKey is an IntegerField with a modified `db_column`.

--
Ticket URL: <https://code.djangoproject.com/ticket/29126>
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/048.fd040dbcdfb909dd92e9c768f04d7cb9%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: [Django] #29126: Model.update_or_create method pk issue.

Django
#29126: Model.update_or_create method pk issue.
-------------------------------------+-------------------------------------
     Reporter:  Théo "Bob" Massard   |                    Owner:  nobody
         Type:  Bug                  |                   Status:  new
    Component:  Database layer       |                  Version:  2.0
  (models, ORM)                      |
     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
-------------------------------------+-------------------------------------

Comment (by Tim Graham):

 Can you please include the model and steps to reproduce?

--
Ticket URL: <https://code.djangoproject.com/ticket/29126#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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/063.c12750ff6d34748374a25acacaa9c086%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: [Django] #29126: Document the behavior of QuerySet.update_or_create() with manually specified pks (was: Model.update_or_create method pk issue.)

Django
In reply to this post by Django
#29126: Document the behavior of QuerySet.update_or_create() with manually
specified pks
--------------------------------------+------------------------------------
     Reporter:  Théo "Bob" Massard    |                    Owner:  nobody
         Type:  Cleanup/optimization  |                   Status:  new
    Component:  Documentation         |                  Version:  2.0
     Severity:  Normal                |               Resolution:
     Keywords:                        |             Triage Stage:  Accepted
    Has patch:  1                     |      Needs documentation:  0
  Needs tests:  0                     |  Patch needs improvement:  0
Easy pickings:  0                     |                    UI/UX:  0
--------------------------------------+------------------------------------
Changes (by Tim Graham):

 * type:  Bug => Cleanup/optimization
 * has_patch:  0 => 1
 * component:  Database layer (models, ORM) => Documentation
 * stage:  Unreviewed => Accepted


Comment:

 If I understand the situation you're describing, I believe this is
 expected behavior (see #8419). [https://github.com/django/django/pull/9698
 PR] to document and test it.

--
Ticket URL: <https://code.djangoproject.com/ticket/29126#comment:2>
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/063.52263e42e708f47e3b51c6c8ceacc29f%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: [Django] #29126: Document the behavior of QuerySet.update_or_create() with manually specified pks

Django
In reply to this post by Django
#29126: Document the behavior of QuerySet.update_or_create() with manually
specified pks
--------------------------------------+------------------------------------
     Reporter:  Théo "Bob" Massard    |                    Owner:  nobody
         Type:  Cleanup/optimization  |                   Status:  closed
    Component:  Documentation         |                  Version:  2.0
     Severity:  Normal                |               Resolution:  fixed
     Keywords:                        |             Triage Stage:  Accepted
    Has patch:  1                     |      Needs documentation:  0
  Needs tests:  0                     |  Patch needs improvement:  0
Easy pickings:  0                     |                    UI/UX:  0
--------------------------------------+------------------------------------
Changes (by Théo "Bob" Massard):

 * status:  new => closed
 * resolution:   => fixed


Comment:

 Oh, thanks a lot for pointing it out and updating the documentation!

--
Ticket URL: <https://code.djangoproject.com/ticket/29126#comment:3>
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/063.f01575eb028443168f9a408c26286031%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: [Django] #29126: Document the behavior of QuerySet.update_or_create() with manually specified pks

Django
In reply to this post by Django
#29126: Document the behavior of QuerySet.update_or_create() with manually
specified pks
--------------------------------------+------------------------------------
     Reporter:  Théo "Bob" Massard    |                    Owner:  nobody
         Type:  Cleanup/optimization  |                   Status:  closed
    Component:  Documentation         |                  Version:  2.0
     Severity:  Normal                |               Resolution:  fixed
     Keywords:                        |             Triage Stage:  Accepted
    Has patch:  1                     |      Needs documentation:  0
  Needs tests:  0                     |  Patch needs improvement:  0
Easy pickings:  0                     |                    UI/UX:  0
--------------------------------------+------------------------------------

Comment (by Tim Graham <timograham@…>):

 In [changeset:"e917ea6bec45d7f789ca96a13be15df9521963e1" e917ea6b]:
 {{{
 #!CommitTicketReference repository=""
 revision="e917ea6bec45d7f789ca96a13be15df9521963e1"
 Fixed #29126 -- Doc'd the behavior of QuerySet.update_or_create() with
 manually specified pks.
 }}}

--
Ticket URL: <https://code.djangoproject.com/ticket/29126#comment:4>
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/063.48eee1f77a2161cc77d6281b6e983071%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: [Django] #29126: Document the behavior of QuerySet.update_or_create() with manually specified pks

Django
In reply to this post by Django
#29126: Document the behavior of QuerySet.update_or_create() with manually
specified pks
--------------------------------------+------------------------------------
     Reporter:  Théo "Bob" Massard    |                    Owner:  nobody
         Type:  Cleanup/optimization  |                   Status:  closed
    Component:  Documentation         |                  Version:  2.0
     Severity:  Normal                |               Resolution:  fixed
     Keywords:                        |             Triage Stage:  Accepted
    Has patch:  1                     |      Needs documentation:  0
  Needs tests:  0                     |  Patch needs improvement:  0
Easy pickings:  0                     |                    UI/UX:  0
--------------------------------------+------------------------------------

Comment (by Tim Graham <timograham@…>):

 In [changeset:"4b8e433e1cacd7405d6ae0a88d1776adc0068f10" 4b8e433]:
 {{{
 #!CommitTicketReference repository=""
 revision="4b8e433e1cacd7405d6ae0a88d1776adc0068f10"
 [2.0.x] Fixed #29126 -- Doc'd the behavior of QuerySet.update_or_create()
 with manually specified pks.

 Backport of e917ea6bec45d7f789ca96a13be15df9521963e1 from master
 }}}

--
Ticket URL: <https://code.djangoproject.com/ticket/29126#comment:5>
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/063.416f1a16a63e6854d6788affb377d179%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.