Hi,

I need to be able to define tables that reference other tables not yet 
defined (because of the order in which define_table is called).

Something like the following (simplified for this discussion):

    db.define_table(x'table1', Field('xtest'), Field('xref2', 'reference 
table2'))
    db.define_table('xtable2', Field('xtest'))

If I execute the above with sqlite, there's no error.

But if I execute it with postgresql (with latest web2py), then I get the 
following error:

   <class 'psycopg2.ProgrammingError'>(relation "xtable2" does not exist)

Would defining all tables in a single db transaction (somehow) solve this 
problem?.

Or would I have to implement a trick like defining all tables empty (with no 
fields) first and then re-defining all tables with all correct fields 
afterwards?.

Or what would you recommend to solve this issue?.

Thanks,

   Carlos

Reply via email to