We can rename each field in VALUES clause:
=# SELECT * FROM (VALUES(123, 'ABC', NULL)) AS t(a,b,c);
a | b | c
-----+-----+---
123 | ABC |
(1 row)
But I cannot find ways for ROW expression to do the same thing:
=# SELECT ROW(123, 'ABC', NULL) AS (a,b,c);
ERROR: syntax error at or near "("
LINE 1: SELECT ROW(123, 'ABC', NULL) AS (a,b,c);
^
=# SELECT (ROW(123, 'ABC', NULL)).*;
ERROR: record type has not been registered
Is it possible to change names fields in ROW?
We can use CREATE TYPE AS on ahead, but I'd like to
change names of ROW expression in ad-hoc queries.
--
Itagaki Takahiro