Ryan Murphy <ryanfmurphy@gmail.com> writes:
> Interesting, thanks! Do you know why the first one fails instead of doing
> that renaming process, while your version succeeds?
You're confused about the input vs. the output. The output columns
of a view all have to have distinct names, just like you can't do
"create table foo (f1 int, f1 int)". They can be reading the same
values, though.
regards, tom lane