Re: Error: rows returned by function are not all of the same row type

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Andrey Sychev <andrey(dot)sychev(at)cifrasoft(dot)com>
Cc: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Error: rows returned by function are not all of the same row type
Date: 2019-07-04 14:38:42
Message-ID: 28764.1562251122@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Andrey Sychev <andrey(dot)sychev(at)cifrasoft(dot)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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2019-07-04 14:45:17 Re: Expression of check constraint
Previous Message Thomas Kellerer 2019-07-04 13:18:01 Why does jsonb_set() remove non-mentioned keys?