ERROR: record type has not been registered
This was a random attempt to figure something out about min/max on row
types:
=> select min(a) from (values (row(1,2,3)), (row(3,4,5))) as x(a);
ERROR: 42809: record type has not been registered
LOCATION: lookup_rowtype_tupdesc_internal, typcache.c:341
I don't know whether it's supposed to work, but the error message
doesn't help much. Perhaps room for improvement?
Peter Eisentraut <peter_e@gmx.net> writes:
This was a random attempt to figure something out about min/max on row
types:
=> select min(a) from (values (row(1,2,3)), (row(3,4,5))) as x(a);
ERROR: 42809: record type has not been registered
LOCATION: lookup_rowtype_tupdesc_internal, typcache.c:341
I don't know whether it's supposed to work, but the error message
doesn't help much. Perhaps room for improvement?
Hmm. It's not going to work because there is no min(record) aggregate.
However, it's failing before it figures that out. The problem seems
to be in expandRecordVariable:
/*
* This case should not occur: a column of a table or values list
* shouldn't have type RECORD. Fall through and fail (most
* likely) at the bottom.
*/
The comment is correct that we don't allow nameless record types as
columns of real tables. Maybe we need to disallow them as columns of
VALUES, too.
regards, tom lane