#1269 ✓resolved

"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

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.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »