Opened 13 years ago

Closed 10 years ago

#18320 closed Bug (worksforme)

Unit test model_formsets_regress.FormsetTests.test_extraneous_query_is_not_run expects wrong number of queries

Reported by: Michael Manfre Owned by: nobody
Component: Testing framework Version: dev
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

For database backends with feature can_return_id_from_insert = False, there should be an expected second query, which fetches the newly inserted pk.

Attachments (2)

django-ticket18320.diff (1.1 KB ) - added by Michael Manfre 13 years ago.
Check conection features to determine proper num of expected queries.
django-ticket18320.2.diff (1.5 KB ) - added by Michael Manfre 13 years ago.
Added feature 'query_needed_to_fetch_return_id'

Download all attachments as: .zip

Change History (7)

by Michael Manfre, 13 years ago

Attachment: django-ticket18320.diff added

Check conection features to determine proper num of expected queries.

comment:1 by Anssi Kääriäinen, 13 years ago

Triage Stage: UnreviewedAccepted

Looks good. But why does this test not fail on any of core backends?

Not marking as RFC as I haven't actually applied the patch.

comment:2 by Michael Manfre, 13 years ago

Patch needs improvement: set

You raised a valid question. can_return_id_from_insert = False does not necessarily imply that a separate query is needed to fetch the return_id. Updating patch pending.

by Michael Manfre, 13 years ago

Attachment: django-ticket18320.2.diff added

Added feature 'query_needed_to_fetch_return_id'

comment:3 by Michael Manfre, 13 years ago

Patch needs improvement: unset

The other backends are able to pull the insert id from the cursor without an additional query.

comment:4 by Tim Graham, 10 years ago

Is this still desired or did you find another solution in the past 2 years? It looks like it was just forgotten.

comment:5 by Michael Manfre, 10 years ago

Resolution: worksforme
Status: newclosed

I found another solution and forgot about this case. Closing.

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