[PATCH] Allow anonymous rowtypes in function return column definition - Mailing list pgsql-hackers

From Elvis Pranskevichus
Subject [PATCH] Allow anonymous rowtypes in function return column definition
Date
Msg-id 11038447.kQ5A9Uj5xi@hammer.magicstack.net
Whole thread Raw
Responses Re: [PATCH] Allow anonymous rowtypes in function return column definition
List 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

pgsql-hackers by date:

Previous
From: Alvaro Herrera
Date:
Subject: rewrite ExecPartitionCheckEmitError
Next
From: Andres Freund
Date:
Subject: Re: don't create storage when unnecessary