Oh, some more fun: a RowExpr that's labeled with a named composite type
(rather than RECORD) has the same issue of not respecting aliases.
Continuing previous example with table "foo":
regression=# create view vv as select * from foo;
CREATE VIEW
regression=# select row_to_json(q) from vv q; row_to_json
-----------------{"f1":1,"f2":2}
(1 row)
regression=# select row_to_json(q) from vv q(a,b); row_to_json
-----------------{"f1":1,"f2":2}
(1 row)
So that's another case we probably want to change in HEAD but not the back
branches.
regards, tom lane