I've run against table inheritance problems (documented in 
http://code.google.com/p/web2py/issues/detail?id=649 and 
http://code.google.com/p/web2py/issues/detail?id=648) and others have too 
(http://code.google.com/p/web2py/issues/detail?id=353). Patches are 
provided with specific solutions.

However, I think there's a general underlying solution that should be 
adopted:

Right now, when table s inherits from table p, it copies all the "real" 
fields, with their applied validators etc -- which is not what is 
tentatively expected, and leads to issues described above.

I think a better solution would be to store in the table a copy of all the 
fields passed in, *before* validators and primary key decisions are made, 
and when table inheritance is required, copy the original fields, rather 
than the applied fields, and then compute their validators / keys properly 
with respect to the inheriting table s.
This would also allow introducing a field type for self reference (e.g. 
'self') which would always refer to its own table, and solve issue 649.

If I understand correctly, any instance in which the behaviour of this 
solution would deviate from how web2py behaves today is an ambiguous or 
unspecified or buggy behaviour today -- but I might have missed something.

Reply via email to