In function get_count lines 5 and 6 are:
{{{
obj.add_annotation(Count('*'), alias='__count', is_summary=True)
number = obj.get_aggregation(using, ['__count'])['__count']
}}}
Code produced looks like:
{{{
SELECT COUNT(*) AS __count FROM MYTABLE
}}}
Error Returned:
{{{
[SQL0104] Token _ was not valid. Valid tokens: <IDENTIFIER>. [SQL
State=42601, DB Errorcode=-104]
}}}
Cause:
Underscore is not valid as a beginning character for a token in DB2.
Suggested Solution:
{{{
Do not use '__count' as a token in the 5th and 6th lines of get_count.
Instead use a token name that does not begin with '_' (Underscore).
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/29491>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
Comment (by Simon Charette):
Is there anyway for the DB2 adapter to quote such identifiers? Would that
make them valid?
For example, the MySQL backend's `quote_name` wraps names in backtips `
resulting the in the following query
{{{#!python
SELECT COUNT(*) AS `__count` FROM `table`
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/29491#comment:1>
* owner: nobody => Jeff
* status: new => assigned
--
Ticket URL: <https://code.djangoproject.com/ticket/29491#comment:2>
* status: assigned => closed
* resolution: => wontfix
Comment:
Closing as wontifx absent justification that the problem can't be fixed in
the DB2 backend.
--
Ticket URL: <https://code.djangoproject.com/ticket/29491#comment:3>