[Django] #18485: Document behavior of PostgreSQL/Oracle when manually setting autoincrementing fields

13 views
Skip to first unread message

Django

unread,
Jun 19, 2012, 12:30:24 PM6/19/12
to django-...@googlegroups.com
#18485: Document behavior of PostgreSQL/Oracle when manually setting
autoincrementing fields
---------------------------------+-----------------------------------------
Reporter: greg.nicholas@… | Owner: nobody
Type: Uncategorized | Status: new
Component: Documentation | Version: 1.4
Severity: Normal | Keywords: postgresql oracle autofield
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
---------------------------------+-----------------------------------------
As described in #11423, certain DB backends will not automatically set the
sequence number for AutoField-based primary keys if the PKs are explicitly
set.

As the ticket discussion states, this is a known feature of PostgreSQL and
Oracle, and the 'sqlsequencereset' management command exists to get the
sequence in sync. MySQL and SQLite handle the resetting automatically.

Although this difference is inherent at the database level, nothing in
Django's database documentation makes this apparent. I would argue that
typical Django users would be completely unaware of this issue (as was I,
coming from a MySQL background). To me, it looked like a bug in the ORM or
in psycopg2.

I suggest that the https://docs.djangoproject.com/en/dev/ref/databases/
page include a warning about this difference, and a reference to the
'sqlsequencereset' command.

--
Ticket URL: <https://code.djangoproject.com/ticket/18485>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Jul 8, 2012, 5:08:20 PM7/8/12
to django-...@googlegroups.com
#18485: Document behavior of PostgreSQL/Oracle when manually setting
autoincrementing fields
-------------------------------------+-------------------------------------
Reporter: greg.nicholas@… | Owner: nobody
Type: | Status: new
Cleanup/optimization | Version: 1.4
Component: Documentation | Resolution:
Severity: Normal | Triage Stage: Accepted
Keywords: postgresql oracle | Needs documentation: 0
autofield | Patch needs improvement: 0
Has patch: 0 | UI/UX: 0
Needs tests: 0 |
Easy pickings: 0 |
-------------------------------------+-------------------------------------
Changes (by aaugustin):

* needs_better_patch: => 0
* stage: Unreviewed => Accepted
* type: Uncategorized => Cleanup/optimization
* needs_tests: => 0
* needs_docs: => 0


Comment:

I think I'd rather put this in the documentation of `AutoField`. Well, the
person who writes the patch get to choose :)

--
Ticket URL: <https://code.djangoproject.com/ticket/18485#comment:1>

Django

unread,
Jun 5, 2017, 2:13:28 PM6/5/17
to django-...@googlegroups.com
#18485: Document behavior of PostgreSQL/Oracle when manually setting
autoincrementing fields
-------------------------------------+-------------------------------------
Reporter: greg.nicholas@… | Owner: nobody
Type: | Status: new
Cleanup/optimization |
Component: Documentation | Version: 1.4
Severity: Normal | Resolution:
Keywords: postgresql oracle | Triage Stage: Accepted
autofield |
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Tim Graham):

As noted in ticket:28272#comment:3, Oracle identity columns (which will be
created as of Django 2.0; 924a89e135fe54bc7622aa6f03405211e75c06e9) aren't
affected.

--
Ticket URL: <https://code.djangoproject.com/ticket/18485#comment:2>

Django

unread,
Jun 17, 2017, 11:39:29 PM6/17/17
to django-...@googlegroups.com
#18485: Document behavior of PostgreSQL/Oracle when manually setting
autoincrementing fields
-------------------------------------+-------------------------------------
Reporter: greg.nicholas@… | Owner: François
Type: | Freitag
Cleanup/optimization | Status: assigned
Component: Documentation | Version: master

Severity: Normal | Resolution:
Keywords: postgresql oracle | Triage Stage: Accepted
autofield |
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by François Freitag):

* owner: nobody => François Freitag
* status: new => assigned
* has_patch: 0 => 1
* version: 1.4 => master


Comment:

[https://github.com/django/django/pull/8652 PR]

--
Ticket URL: <https://code.djangoproject.com/ticket/18485#comment:3>

Django

unread,
Jun 19, 2017, 9:25:33 AM6/19/17
to django-...@googlegroups.com
#18485: Document behavior of PostgreSQL/Oracle when manually setting
autoincrementing fields
-------------------------------------+-------------------------------------
Reporter: greg.nicholas@… | Owner: François
Type: | Freitag
Cleanup/optimization | Status: closed
Component: Documentation | Version: master
Severity: Normal | Resolution: fixed

Keywords: postgresql oracle | Triage Stage: Accepted
autofield |
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tim Graham <timograham@…>):

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


Comment:

In [changeset:"4f1eb64ad0bcebfae4075486855eb6b63355cc5a" 4f1eb64a]:
{{{
#!CommitTicketReference repository=""
revision="4f1eb64ad0bcebfae4075486855eb6b63355cc5a"
Fixed #18485 -- Doc'd behavior of PostgreSQL when manually setting
AutoField.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/18485#comment:4>

Django

unread,
Jun 19, 2017, 9:25:58 AM6/19/17
to django-...@googlegroups.com
#18485: Document behavior of PostgreSQL/Oracle when manually setting
autoincrementing fields
-------------------------------------+-------------------------------------
Reporter: greg.nicholas@… | Owner: François
Type: | Freitag
Cleanup/optimization | Status: closed
Component: Documentation | Version: master
Severity: Normal | Resolution: fixed
Keywords: postgresql oracle | Triage Stage: Accepted
autofield |
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:"712ce47e1a55f7ebd96ac64201a4817ae4743216" 712ce47]:
{{{
#!CommitTicketReference repository=""
revision="712ce47e1a55f7ebd96ac64201a4817ae4743216"
[1.11.x] Fixed #18485 -- Doc'd behavior of PostgreSQL when manually
setting AutoField.

Backport of 4f1eb64ad0bcebfae4075486855eb6b63355cc5a from master
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/18485#comment:5>

Reply all
Reply to author
Forward
0 new messages