#29444: Allow modification of RETURNING values in django.contrib.postgres
-------------------------------------+-------------------------------------
               Reporter:  Johannes   |          Owner:  (none)
  Hoppe                              |
                   Type:  New        |         Status:  new
  feature                            |
              Component:             |        Version:  2.0
  contrib.postgres                   |       Keywords:  django, db,
               Severity:  Normal     |  returning, default, model, field
           Triage Stage:             |      Has patch:  0
  Unreviewed                         |
    Needs documentation:  0          |    Needs tests:  0
Patch needs improvement:  0          |  Easy pickings:  0
                  UI/UX:  0          |
-------------------------------------+-------------------------------------
 Dependency for #27452

 The SQL `RETURNING` statement is currently used for inserts of new
 objects. Mainly it is responsible to return the primary key in a single
 query.

 That's great but currently in the postgres database backend this value is
 hard coded to only the primary key. I would like to propose to make this
 configurable.

 There are plenty of uses cases for such a feature ultimately even enabling
 database defaults, but I would suggest to keep it very simple for now.

 I would suggest to simply allow model fields to specify if they should be
 included in the returning statement or not. The default being not (except
 PK) to maintain the current behavior.

 The implementation as well as the related code lines have been already
 discussed here:
 https://github.com/django/django/pull/7525#issuecomment-354269077

 I highly suggest to keep this a Postgres ONLY feature for now. That way we
 can see what sticks and consider extending this functionality into
 `django.db` in the future after we have seen how it's being used and
 gathered feedback.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/29444>
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/052.664c756aedf4e5d67e8f5771c5b96d87%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to