Re: Error: rows returned by function are not all of the same row type - Mailing list pgsql-general

From Tom Lane
Subject Re: Error: rows returned by function are not all of the same row type
Date
Msg-id 28764.1562251122@sss.pgh.pa.us
Whole thread Raw
In response to Error: rows returned by function are not all of the same row type  (Andrey Sychev <andrey.sychev@cifrasoft.com>)
Responses Re: Error: rows returned by function are not all of the same row type  (Andrey Sychev <andrey.sychev@cifrasoft.com>)
List pgsql-general
Andrey Sychev <andrey.sychev@cifrasoft.com> writes:
> I have written C-language function that returns
> multiple composite rows.
> Generally function works as expected, but sometimes problem takes place.
> At  rough  guess  the  problem  occurs  when  number of returning rows
> relatively large (more than 100K - 1M).

I do not think it's valid to return from your function with the SPI
context still open.  Probably, it seems to accidentally sort of work
as long as you don't return enough rows to cause the outer query to
do anything interesting like spill to disk.

Probably you should re-code this to execute just once and return
a tuplestore.

            regards, tom lane



pgsql-general by date:

Previous
From: Thomas Kellerer
Date:
Subject: Why does jsonb_set() remove non-mentioned keys?
Next
From: Tom Lane
Date:
Subject: Re: Expression of check constraint