
"ambiguous column name: id" querying to-many relation from table to itself
Reported by snej | May 13th, 2010 @ 01:42 PM | in 1.1
I've got a different case of the bug reported in ticket #885, where a many-to-many relation from one table to itself results in a bad SQL query because the table name wasn't aliased. Unfortunately my case is not fixed by the patch that fixes #885.
The error is:
~ ambiguous column name: users.id (code: 1, sql state: , query: SELECT "users"."id", "users"."url" FROM "users" INNER JOIN "relations" ON "users"."id" = "relations"."contact_id" INNER JOIN "users" ON "relations"."contacter_id" = "users"."id" WHERE ("relations"."contacter_id" = 1 AND "users"."url" = 'http://rubylang.org') GROUP BY "users"."id", "users"."url" ORDER BY "users"."id" LIMIT 1, uri: sqlite3://:memory:)
Comments and changes to this ticket
-
snej May 13th, 2010 @ 01:45 PM
I'm a newbie at DataMapper, so please let me know if there's an alternate way to phrase the query that avoids the error. Right now my project is blocked because of this. Thanks.
-
Martin Gamsjaeger (snusnu) January 14th, 2011 @ 10:00 PM
- State changed from new to resolved
- Assigned user set to Dan Kubb (dkubb)
- Milestone set to 1.1
- Milestone order changed from 0 to 0
This is fixed in master: http://pastie.org/1462507
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »