Added _check_consistency call to all statement parts

For instance, enforce where() to be called
Fixed a bunch of warnings
Fixed another few warnings
Added improved check for potential name duplicates in from()