How to rename each field in ROW expression?

From: Itagaki Takahiro <itagaki(dot)takahiro(at)gmail(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: How to rename each field in ROW expression?
Date: 2010-11-15 10:27:25
Message-ID: AANLkTikYqoC1VzjmdSM4hvnHoXDRexG7ZOajp6=P6f9G@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Pavel Stehule 2010-11-15 10:34:19 Re: Per-column collation
Previous Message Bernd Helmle 2010-11-15 10:13:11 Re: [COMMITTERS] pgsql: Improved parallel make support