Fix tests for nested SQL functions