Opened 18 years ago
Closed 18 years ago
#6807 closed (fixed)
execute_sql in django/db/models/sql/query.py fails with MySQL due to incorrect sentinel
| Reported by: | tpherndon | Owned by: | tpherndon |
|---|---|---|---|
| Component: | Core (Other) | Version: | queryset-refactor |
| Severity: | Keywords: | qs-rf | |
| Cc: | Triage Stage: | Accepted | |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | yes |
| Easy pickings: | no | UI/UX: | no |
Description
Line 1333: return iter((lambda: cursor.fetchmany(GET_ITERATOR_CHUNK_SIZE)), []) fails under MySQL because the cursor.fetchmany() call returns an empty tuple as sentinel, rather than an empty list. The empty list sentinel is correct for sqlite. I attempted to run runtests.py, which hung on "Running post-sync handlers for application string_lookup". When I changed the sentinel to a tuple, runtests.py ran to completion (four failing tests, but completion) with MySQL, yet hung in the exact same place with sqlite.
Attachments (1)
Change History (3)
by , 18 years ago
| Attachment: | iterator_sentinel.patch added |
|---|
comment:1 by , 18 years ago
| Has patch: | set |
|---|---|
| Patch needs improvement: | set |
| Triage Stage: | Unreviewed → Accepted |
Nice catch. But I'd prefer to have a function that just returns the "empty sentinel" value in each case, rather than testing for one or the other.
comment:2 by , 18 years ago
| Resolution: | → fixed |
|---|---|
| Status: | new → closed |
Sets iterator sentinel to proper sentinel type for sqlite and mysql backends.