Query analysis and validation for outer joins