#33343: update_or_create seems to issue wrongly limited query to the database
-------------------------------------+-------------------------------------
Reporter: Florian | Owner: nobody
Apolloner |
Type: Bug | Status: new
Component: Database | Version: dev
layer (models, ORM) |
Severity: Normal | Keywords:
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 1
UI/UX: 0 |
-------------------------------------+-------------------------------------
Just dumping this here before I forget -- haven't checked yet if this is
just the logging output or indeed a wrong query:
{{{
In [2]: User.objects.update_or_create(username='test', defaults={})
(0.000) BEGIN; args=None; alias=default
(0.000) SELECT "auth_user"."id", "auth_user"."password",
"auth_user"."last_login", "auth_user"."is_superuser",
"auth_user"."username", "auth_user"."first_name", "auth_user"."last_name",
"auth_user"."email", "auth_user"."is_staff", "auth_user"."is_active",
"auth_user"."date_joined" FROM "auth_user" WHERE "auth_user"."username" =
'test' LIMIT 21; args=('test',); alias=default
(0.000) SAVEPOINT "s140548210464576_x1"; args=None; alias=default
(0.000) INSERT INTO "auth_user" ("password", "last_login", "is_superuser",
"username", "first_name", "last_name", "email", "is_staff", "is_active",
"date_joined") SELECT '', NULL, 0, 'test', '', '', '', 0, 1, '2021-12-07
07:17:48.232962' RETURNING "auth_user"."id"; args=('', None, False,
'test', '', '', '', False, True, '2021-12-07 07:17:48.232962');
alias=default
(0.000) RELEASE SAVEPOINT "s140548210464576_x1"; args=None; alias=default
Out[2]: (<User: test>, True)
}}}
The `LIMIT 21;` here smells like the query executed for the `repr` of a
`Query` object.
--
Ticket URL: <https://code.djangoproject.com/ticket/33343>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.