I have a similar situation.

My table, say, Purchase Order contains two fields: client, endclient.
The client ID from the Clients table is the foreign key for both.

For the above table, when I try AppAdmin, I get the broken reference
error.

I think that two fields in a single table both referring to another
table could cause this problem.

In fact, even my select (db().select()) on this table, with
appropriate with_alias causes the same error if I try a view. Do you
know how I solve that? I create the db().select() and capture the
lastsql and execute it as direct sql and that seems to work!

Any inputs are welcome. I think you can quickly recreate the
situation. If you need the full code from me, let me know.

Regards.

Sundar

On Sep 26, 11:16 pm, weheh <richard_gor...@verizon.net> wrote:
> Massimo, as I said, there are 2 processes. The background process is a
> queueing engine. The queue is doing stuff like you describe: creating
> and deleting records and writing out to a log file. However, the queue
> is running just fine and doesn't have the "print a.xxx" statement that
> you flag as the culprit above.
>
> The problem is with the "show()" controller function that outputs to
> the browser a display of the current status of the queue. All it does
> is create an SQLTable from a query and then display the results in a
> view. The queue and show processes are completely separate.
>
> Any more thoughts?
>
> On Sep 26, 9:57 am, mdipierro <mdipie...@cs.depaul.edu> wrote:
>
>
>
> > somehow you are doing something like this
>
> > a=db.mytable.insert(myfield='xxx')
> > del db.mytable[a]
> > print a.xxx  ### <<< your error
>
> > The problem should only exist if the three statements happen in the
> > same process because of transactions.
>
> > On Sep 26, 3:38 am, weheh <richard_gor...@verizon.net> wrote:
>
> > >   File "C:\web2py\gluon\sql.py", line 1501, in __allocate
> > >     raise RuntimeError, "Using a recursive select but encountered a
> > >brokenreference"
> > > RuntimeError: Using a recursive select but encountered abroken
> > >reference
>
> > > I encountered this problem trying to do a select and display in the
> > > browser, while simultaneously running a background job that updates
> > > the db. If I refresh the browser, sometimes I get the error and
> > > sometimes I don't. Seems like a locking problem. I am not using a cron
> > > task. I am running a separate python web2py.py using the -S -M and -R
> > > options.

Reply via email to