This is an interesting one. This depends on the expectation around cast, which has never been fully designed. What I mean is it depends on how you answer questions about whether the cast operates in memory or on the database. We always pass-through the cast call (in some form) to the SQL, hence the check because casting a tuple is (generally) not valid.
TBH, not sure this is something we want to fix. Or at least I am not sure how to marry fixing it for a case like this with more common cases of wanting the cast in the generated SQL.
|