From: Oleg B. <ph...@ph...> - 2004-12-16 19:21:08
|
On Thu, Dec 16, 2004 at 05:43:54PM +0300, Oleg Broytmann wrote: > On Thu, Dec 16, 2004 at 01:16:25PM +0200, Ksenia Marasanova wrote: > > Employee.select(orderBy='first_name') > > > > produces: > > > > SELECT employee.id, employee.child_name FROM employee WHERE 1 = 1 > > ORDER BY person.first_name > > > > then Postgres reacts to that like 'NOTICE: adding missing FROM-clause > > entry for table "person"' > > > > which results in double number of records in the resultset because the > > tables are not joined properly. Please try the attached patch and run Employee.select(orderBy=Person.q.firstName) Does it help? Please note that in case you use strings in the query on in the orderBy (orderBy="first_name") it would not work. As was said by Daniel Savard: #DSM: because if the user uses clauseTables #DSM: (and normal string SELECT), he must know what he wants #DSM: and will do himself the relationship between classes. Oleg. -- Oleg Broytmann http://phd.pp.ru/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |