> I think that in cases where there's not a semantic hazard involved, > we'd usually have pulled up the subquery so that this is all moot > anyway. >
I get your point with this statement. Things driven by this idea look practical and lucky. But for the UniqueKey stuff, we are not that lucky. SELECT pk FROM t; -- Maintain the UniqueKey would be not necessary. However SELECT DISTINCT pk FROM (SELECT volatile_f(a), pk from t) WHERE ..; Maintaining the UniqueKey in subquery is necessary since it is useful outside. -- Best Regards Andy Fan (https://www.aliyun.com/)