Hi Rick,
In web2py version 1.87.3, when I define the tables:
db.define_table('a',
Field('name'),
migrate='a.table')
db.define_table('b',
Field('a_id', db.a),
migrate='b.table')
... insert a few records in a, and try to insert an empty record in b,
I get this error:
ValueError: invalid literal for int() with base 10: ''
When I enter an empty record using the SQLite Database Browser 1.3 and
then execute db.(db.b.id>0).select() the view displays the content of
table b:
b.id 1 b.a_id None.
In web2py version 1.89.4 with the same table definitions, when I try
to insert an empty record in b, the record is simply inserted. When I
execute db.(db.b.id>0).select() I get the same error you got:
RuntimeError: Using a recursive select but encountered a broken
reference
The whole problem is solved by adding a validator to b's table
definition:
db.b.a_id.requires=[IS_IN_DB(db,db.a.id)]
I posted a similar problem a few days ago:
http://groups.google.com/group/web2py/browse_thread/thread/fa47540066831de4/ff86abc2ca4c8520#ff86abc2ca4c8520
Denes explained the cause of the problem.
Kind regards,
Annet.