odd arbitrary select+mapper issue
Issue #1364
resolved
I have an arbitrary select statement as a property in a mapper. When I select directly from it the query ran is:
SELECT room.building_id, jack.id AS jack_id, jack.number
FROM room, jack, closet
WHERE jack.closet_id = closet.id AND closet.room_id = room.id
but when ran from the mapper it does:
SELECT jack.id AS jack_id, jack.room_id AS jack_room_id, jack.closet_id AS jack_closet_id, jack.number AS jack_number, jack.room_building_id AS jack_room_building_id
FROM jack, (SELECT room.building_id AS building_id, jack.id AS jack_id, jack.number AS number
FROM room, closet
WHERE jack.closet_id = closet.id AND closet.room_id = room.id) AS building_jacks
WHERE ? = building_jacks.building_id AND jack.id = building_jacks.jack_id
leaving out the 'jack' in the inner subselect
I'm attaching a script that shows the incorrect query. The script is simplified from something that has been working for a while on 0.4. The interesting thing is that the really simple version breaks on both 0.4 and 0.5, but the more complicated example that has the union works on 0.4.
- Justin
Comments (3)
-
repo owner -
Account Deleted That did help, thanks :-)
-
- changed status to invalid
- Log in to comment
throw correlate(None) on your subselects, that will likely resolve the issue.