db.define_table('tt2',
Field('ttref', 'reference tt'),
Field('vv2', 'integer'))
tt1 = db.tt.insert(vv='1')
tt2 = db.tt.insert(vv='3')
db.tt2.insert(ttref=tt1, vv2='3')
db.tt2.insert(ttref=tt2, vv2='4')
records = db(db.tt).select( db.tt.ALL, db.tt2.ALL,
join=[db.tt2.on(db.tt2.ttref == db.tt.id)] )
for r in records:
print r
Result:
<Row {'tt2': {'ttref': 1L, 'id': 1L, 'vv2': 3L}, 'tt': {'id': 1L, 'vv': 1L}}>
<Row {'tt2': {'ttref': 2L, 'id': 2L, 'vv2': 4L}, 'tt': {'id': 2L, 'vv': 3L}}>
As you can see virtual field 'x' (in table 'tt') is missing. As I understand this occurs when selecting records from more than one table. In my case (with PostgreSQL) every time I use db(...).select(db.table.ALL, TOTAL_ROWS, ...) where TOTAL_ROWS = 'COUNT(*) OVER()'.