Opened 11 years ago
Last modified 10 years ago
#25064 closed Bug
Join.as_sql() emits invalid SQL if get_joining_columns() returns an empty tuple — at Version 1
| Reported by: | Alex Hill | Owned by: | nobody |
|---|---|---|---|
| Component: | Database layer (models, ORM) | Version: | 1.8 |
| Severity: | Normal | Keywords: | |
| Cc: | Triage Stage: | Accepted | |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | yes |
| Easy pickings: | no | UI/UX: | no |
Description (last modified by )
Join.as_sql() gets its join conditions from two places: the get_joining_columns() and get_extra_restrictions().
The SQL for extra restrictions is unconditionally prefixed with AND, which means invalid SQL is emitted if no joining columns are specified. The fix to make the AND conditional is a one-liner and allows users to override the default join conditions instead of adding to them.
Change History (1)
comment:1 by , 11 years ago
| Description: | modified (diff) |
|---|---|
| Summary: | Allow get_joining_columns to return empty tuple → Join.as_sql() emits invalid SQL if get_joining_columns() returns an empty tuple |
Note:
See TracTickets
for help on using tickets.