Daniel Gustafsson <daniel@yesql.se> writes:
>> On 19 May 2022, at 14:03, PG Bug reporting form <noreply@postgresql.org> wrote:
>> I found something weird. Restoring a view fails if this view contains an
>> attribute without alias name.
> This is not unique to 14, it can be reproduced further down as well.
Yeah, it's an ancient behavior; interesting that no one has complained
before. This code in ruleutils is assuming that FigureColname will
make the same choice at reload as it did before; which is shaky both
because we aren't necessarily printing the identical raw text, and
because there's no guarantee we won't change those rules in future.
Perhaps we should just tweak ruleutils so that the alias is always
printed for non-Var columns, even when it's "?column?". That's kind of
ugly, but if you wanted non-ugly you should have selected a better column
name to start with.
regards, tom lane