[PATCH] Allow anonymous rowtypes in function return column definition

From: Elvis Pranskevichus <el(at)prans(dot)net>
To: pgsql-hackers(at)postgresql(dot)org
Subject: [PATCH] Allow anonymous rowtypes in function return column definition
Date: 2018-12-06 22:27:32
Message-ID: 11038447.kQ5A9Uj5xi@hammer.magicstack.net
Views: Raw Message | Whole Thread | Download mbox
Thread:
Lists: pgsql-hackers

Currently, the following query

SELECT q.b = row(2)
FROM unnest(ARRAY[row(1, row(2))]) AS q(a int, b record);

would fail with

ERROR: column "b" has pseudo-type record

This is due to CheckAttributeNamesTypes() being used on a function
coldeflist as if it was a real relation definition. But in the context
of a query there seems to be no harm in allowing this, as other ways of
manipulating anonymous rowtypes work well, e.g.:

SELECT (ARRAY[ROW(1, ROW(2))])[1];

Elvis

Attachment Content-Type Size
0001-Allow-anonymous-rowtypes-in-function-return-column-d.patch text/x-patch 7.8 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2018-12-06 22:51:15 Re: don't create storage when unnecessary
Previous Message Alvaro Herrera 2018-12-06 22:22:21 rewrite ExecPartitionCheckEmitError