When using a parent/child schema, after listing the parent table in the upper_right frame, and
clicking on 'click here' in the column with the link to the child table, I get error (1054,
"Unknown column 'fk_parentID' in 'where clause'"). I should also say that the child
table manager has "Field to Show" set to display a column from the parent table,
requiring a lookup with the parent foreign key when displaying the child table in the lower_right
frame. (And I should also say I'm using MySQL.)
On inspecting the code (including instrumenting it with LOG statements), it appears that clicking on the child table link sets
a SESSION program_filter (fk_parentID = <value>) which, since it is a SESSION variable, is not cleared by the
clear_request call in the child list_form when looking up the parent column value. So the SQL issued for the foreign key
lookup of the parent column value when trying to list the child table has the SESSION program filter "fk_parentID =
<value>" constraint in the "where" phrase, as well as the parent primary key
"parent=<value>" constraint. Since fk_parentID is a child table column not in the parent table, the SQL, which
is operating on the parent table, fails.
The fix would seem to be in list_form (and probably the other forms) when
looking up a foreign key column to push and clear the SESSION
program_filter_internal value before the
tal:repeat="fk_record python:here.parent.select_action(params)"
foreign key lookup, and then pop the SESSION program_filter_internal value
afterwords, assuming that the program_filter has been set in SESSION to hang
around and be used later.
Unfortunately, I'm not enough of a Zope hacker (yet) and too new to zetadb to
actually figure out a fix. It may be that I've got something misconfigured, or
there might be a simpler fix than the one I've outlined.
Has anybody else had this problem, or can suggest a fix?
Thank you.
-- Michael Heathman
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
|