Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#18223 closed Uncategorized (fixed)

Database commit behavior is confusingly documented

Reported by: philipn Owned by: mateusgondim
Component: Documentation Version: 1.3
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Reading https://docs.djangoproject.com/en/dev/ref/databases/:

Transaction handling

By default, Django starts a transaction when a database connection is first used and commits the result at the end of the request/response handling. The PostgreSQL backends normally operate the same as any other Django backend in this respect.

Then reading https://docs.djangoproject.com/en/dev/topics/db/transactions/:

Django’s default behavior is to run with an open transaction which it commits automatically when any built-in, data-altering model function is called. For example, if you call model.save() or model.delete(), the change will be committed immediately.


https://docs.djangoproject.com/en/dev/topics/db/transactions/ describes the current behavior. It seems like the other documentation should be updated to reflect this.

Attachments (1)

ticket18223.diff (855 bytes) - added by mateusgondim 3 years ago.
Hi, I replaced the wrong sentence with the right one.

Download all attachments as: .zip

Change History (7)

comment:1 Changed 3 years ago by philipn

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

It looks like the first case is what happens if you have TransactionMiddleware enabled -- but it's not on by default.

comment:2 Changed 3 years ago by akaariai

  • Triage Stage changed from Unreviewed to Accepted

True - the PostgreSQL specific documentation isn't correct.

comment:3 Changed 3 years ago by mateusgondim

  • Owner changed from nobody to mateusgondim

Changed 3 years ago by mateusgondim

Hi, I replaced the wrong sentence with the right one.

comment:4 Changed 3 years ago by mateusgondim

  • Has patch set

comment:5 Changed 3 years ago by Tim Graham <timograham@…>

  • Resolution set to fixed
  • Status changed from new to closed

In [2079b730f139685bcedf0c92d5ed9a3f64b51e9f]:

Fixed #18223 - Corrected default transaction behavior in postgresql docs.

Thanks philipn for the report and mateusgondim for the patch.

comment:6 Changed 3 years ago by Tim Graham <timograham@…>

In [01b02317172a5030b77a09aada11657c00398416]:

[1.4.X] Fixed #18223 - Corrected default transaction behavior in postgresql docs.

Thanks philipn for the report and mateusgondim for the patch.

Backport of 2079b730f1 from master

Note: See TracTickets for help on using tickets.
Back to Top