#21454: Ignoring certain fields on INSERT and UPDATE queries
-------------------------------------+-------------------------------------
     Reporter:  mpessas              |                    Owner:  mpessas
         Type:  New feature          |                   Status:  assigned
    Component:  Database layer       |                  Version:  master
  (models, ORM)                      |               Resolution:
     Severity:  Normal               |             Triage Stage:  Accepted
     Keywords:  oracle               |      Needs documentation:  0
    Has patch:  1                    |  Patch needs improvement:  0
  Needs tests:  0                    |                    UI/UX:  0
Easy pickings:  0                    |
-------------------------------------+-------------------------------------

Comment (by mpessas):

 Replying to [comment:5 manfre]:
 > It's possible that a database backend is capable of returning the IDs
 from an insert without supporting the {{{RETURNING}}} clause. Those should
 be separate features. I previously injected a select statement to return
 the inserted ID without needing a second round trip to the MSSQL server.
 It's also possible that certain database drivers may return newly inserted
 IDs without SQL.
 >

 True, this has been implemented at
 
https://github.com/mpessas/django/commit/c7ca041347b9c8b24285cb0c94ba3eefeded707e.

 Replying to [comment:6 manfre]:
 >The use_on_insert and use_on_update arguments could get merged in to an
 edit_behavior argument (probably needs a better name) that expects one of
 the following constant values:
 >
 >DEFAULT - use_on_insert == True and use_on_update == True
 >CREATE_ONLY - use_on_insert == True and use_on_update == False
 >UPDATE_ONLY - use_on_insert == False and use_on_update == True
 >READ_ONLY - use_on_insert == False and use_on_update == False

 That is a good idea, see commit
 
https://github.com/mpessas/django/commit/a8a19b65774383bc47d3fb04ca6966ba4a4cba94
 (a better name is welcome).

 The `always_refresh` feature sounds interesting and I will take a look; it
 should not be that hard.

 Keep in mind, by the way, that as far as I can tell and at least in
 PostgreSQL the `RETURNING` clause does not "work" with an ''after''
 trigger; that is, if a field is changed by an `AFTER INSERT` or `AFTER
 UPDATE` trigger will not be returned with a `RETURNING` clause.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/21454#comment:9>
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.8dabe2eb1ba7ac18c2c32b3f6167d21a%40djangoproject.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to