Opened 17 years ago

Closed 17 years ago

#6574 closed (wontfix)

Make queries not select fields that has db_type None

Reported by: oyvind Owned by: nobody
Component: Uncategorized Version: queryset-refactor
Severity: Keywords: db_type query fields
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: yes
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Since sql_model_create in django/core/management/sql.py does not create fields that has db_type None, queries should not try to select a non-existing field.

Would be solvable in qs-rf by this small change in

http://code.djangoproject.com/browser/django/branches/queryset-refactor/django/db/models/sql/query.py#L392

elif self.default_cols:
    table_alias = self.tables[0]
    result = ['%s.%s' % (qn(table_alias), qn(f.column))
        for f in self.model._meta.fields]
    aliases = result[:]

Should be:

elif self.default_cols:
    table_alias = self.tables[0]
    result = ['%s.%s' % (qn(table_alias), qn(f.column))
        for f in self.model._meta.fields if f.db_type()]
    aliases = result[:]

Attachments (1)

db_type_none.diff (1.6 KB ) - added by oyvind 17 years ago.
Added patch with tests for queryset-refactor

Download all attachments as: .zip

Change History (3)

by oyvind, 17 years ago

Attachment: db_type_none.diff added

Added patch with tests for queryset-refactor

comment:1 by anonymous, 17 years ago

Has patch: set
Needs documentation: set
Version: SVNqueryset-refactor

comment:2 by Malcolm Tredinnick, 17 years ago

Resolution: wontfix
Status: newclosed

No, this doesn't look right. Those fields can be created via a different mechanism (as they are in GeoDjango, for exmaple).

What is the problem you're actually trying to solve here. Note that intelligent column selection is still work in progress on queryset-refactor -- I haven't merged in some of Justin's suggested changes, for example -- so don't get too far ahead of the ballgame here, but a description of what you're trying to do might help guide future design work.

Perhaps open another ticket with a description of what currently doesn't work so that it doesn't get confused with this one.

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