#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:                       |      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:3 mpessas]:
 > Replying to [comment:2 akaariai]:
 > > It would be really useful to do autorefresh after save. Access to
 database set values could also be done with RETURNING, but for first
 implementation just executing a query from .save() would be enough.
 >
 > I would rather avoid the extra query to re-read the db-default values;
 it would have a significant impact on performance, when one of the goals
 was to improve performance in the first place.
 >
 > Regarding the `RETURNING` clause, it is not part of the SQL standard
 AFAIK (see http://www.postgresql.org/docs/9.1/static/sql-
 update.html#AEN76402) and that's the reason I avoided it. That said, can
 we have backend-specific codepaths in Django? That is, use the `RETURNING`
 clause, when available, and fallback to a re-read query otherwise.
 >
 > In any case, I suppose we should allow the developer to skip the re-read
 query, if using the `RETURNING` clause is not possible. How does that
 sound?
 >

 Check commit
 
https://github.com/mpessas/django/commit/dac93937c66040cb901e5e48bd6deba5ce51de9e.
 If the backend supports the RETURNING clause, we use that to fetch the
 values the database has given to the db-default fields. Otherwise, an
 extra SELECT query is issued. If the user does not want this overhead, he
 can set `force_fetch=False` (which is the default).

 There are two main issues here: I have not checked yet how this works,
 when Model inheritance is used and the Oracle backend is broken.

 Regarding the latter, I have not found any helpful docs about the
 RETURNING clause and I cannot test it either. Is there someone I could ask
 or should I contact the cx_oracle developers directly?

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

Reply via email to