My database table started giving errors when I added a field that
references itself. I think it is related to the other messages in this
thread because I get the same error message:

RuntimeError: Using a recursive select but encountered a broken
reference

This error is raised after I use the appadmin interface to insert an
element (http://localhost:8000/inbite/appadmin/insert/db/inbite) and
then query all the rows in the table
(http://localhost:8000/inbite/appadmin/select/db?query=db.inbite.id%3E0)



The error is propogated from line 191 of appadmin.html:
response.write(SQLTABLE(rows,linkto,upload,orderby=True,_class='sortable'))
until line 1537 of sql.py in __allocate



If I drop the table, the error is not raised until I insert another
row. Also if I comment out the field that adds the self-referential
column, the error is not raised. I can also continue to keep inserting
more rows via the appadmin interface.

Here is the model:

db.define_table('inbite',

Field('code', 'string', length= 8, default=None,
required=True, notnull=True, unique=True),
Field('email', 'string', length=50, default=None,
notnull=False, unique=False),
Field('invites_left', 'integer', default=2),
Field('parent', 'reference inbite', default=None)
)


I have a feeling the error might be related to SQLite broken
migrations. The parent field used to be a string before I learned
self-referential fields were possible. However, I dropped the table so
indexing started at 1 again; is this enough to rule out SQLite
migration issues?


Thanks for any assistance~
John

Reply via email to