Adding tests for 'with' and 'invalidate metadata' sql queries