Django

Code

Ticket #7045 (closed: fixed)

Opened 5 months ago

Last modified 5 months ago

extra(tables=...) was sometimes causing an exception

Reported by: anonymous Assigned to: nobody
Milestone: Component: Database wrapper
Version: queryset-refactor Keywords:
Cc: Triage Stage: Accepted
Has patch: 0 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 0

Description (Last modified by mtredinnick)

Customer.objects.extra(select={'mid' : '!customerj.id'}, tables=['customerj'], where=['!app_customer.id=customerj.id'])

raises exception:

Request Method:  	POST[[BR]]
Request URL: 	!http://127.0.0.1:8000/app/CustomerList/ [[BR]]
Exception Type: 	!KeyError[[BR]]
Exception Value: 	'customerj'[[BR]]
Exception Location: 	/home/bring/src/queryset-refactor/django/db/models/sql/query.py in get_from_clause, line 423[[BR]]
Python Executable: 	/usr/bin/python[[BR]]
Python Version: 	2.5.1

Attachments

Change History

04/20/08 20:11:34 changed by mtredinnick

  • needs_better_patch changed.
  • description changed.
  • needs_tests changed.
  • needs_docs changed.

Fixed description.

04/23/08 05:33:59 changed by mtredinnick

  • summary changed from db.models.sql.Query.add_extra() does not append extra tables to Query.alias_map dict to extra(tables=...) was sometimes causing an exception.
  • stage changed from Unreviewed to Accepted.

The original title of this ticket isn't actually a bug; it's intentional. I've changed the title to reflect the real problem a bit better in case somebody else is seeing this.

After a bit of experimenting, however, I was able to repeat the problem you're seeing and it's not quite for the reason you thought. It only happened when get_from_clause() was called more than once. The commit to fix this ticket handles that case now.

04/23/08 05:43:42 changed by mtredinnick

  • status changed from new to closed.
  • resolution set to fixed.

(In [7447]) queryset-refactor: Fixed a crash when using extra(tables=...). Fixed #7045.


Add/Change #7045 (extra(tables=...) was sometimes causing an exception)




Change Properties
Action