Ticket #34 (closed defect: fixed)
Elixir fails during insert and update on MySQL 5.x when using the list extension.
| Reported by: | guest | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | extensions | Version: | |
| Keywords: | acts_as_list, mysql | Cc: | alice@… |
Description
MySQL 5.x requires that sub-selects be given unique aliases to prevent confusion, whereas I assume older versions of MySQL did not enforce this. Attempting to use the elixir.ext.list acts_as_list functionality, I ran into the following Exception: (wrapped with data removed)
sqlalchemy.exceptions.OperationalError: (OperationalError) (1248,
'Every derived table must have its own alias')
u'INSERT INTO objects (commission_id, creator_id, location_id, uuid, title, description, filename, mime, created, updated, published, position)
VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, (
SELECT max(value) AS max_1
FROM (SELECT max(objects.position) + %s AS value
FROM objects
WHERE objects.location_id IS NULL UNION SELECT %s AS value)))'
Attached to this ticket is a patch which solves this problem using an alias of the sub-select.
Attachments
Change History
Note: See
TracTickets for help on using
tickets.
