I think the citext extension[1] already made much of this straightforward?
What I'm most excited about is the fact that WITH clauses will no longer necessarily be optimization fences — I have some big queries that are really only manageable this way, and now they may well be very much faster.
>I think the citext extension[1] already made much of this straightforward?
sort of. It was doing case-folding based on LC_CTYPE set at initdb time, so if you have data of different locales to deal with, it would only work for one locale and be (subtly) broken for others (Turkish comes to mind)
It's also based on glibc's interpretation of case-folding rather than what the Unicode consortium has agreed upon.
Depending on locale and tolerance to weirdness that can be anywhere between a non-issue and a show-stopper.
Creating views makes more sense sometimes and CTEs make more sense other times.
Creating views just for one query is kind of like creating temporary variables for each subexpression. Sure, it works, but not a great solution.
Also, other databases do optimize through a CTE. So if you port to PG 11, you might see a lot of regressions in plans unless you rewrite to use views instead. PG 12 will work a lot better for existing queries.