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

From: Joe Conway <mail(at)joeconway(dot)com>
To: Andrey Sychev <andrey(dot)sychev(at)cifrasoft(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
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-05 12:15:43
Message-ID: a25731e4-cf4d-27c2-2a7a-a0fe6ec64d82@joeconway.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 7/5/19 5:39 AM, Andrey Sychev wrote:
> Thank you very much for answering my question, Tom.
> Yes, I have always assumed that returning from function without
> calling SPI_freetuptable is not good idea, but I do not know another
> way to achieve same result.

Please do not top post on the Postgres lists.

> 1. As I understand there are tests for SFRM_Materialize in code above.
> In my case a caller of my function is PL/pgSQL procedure.
> Does it accept this returning mode?

See contrib/tablefunc/tablefunc.c crosstab_hash() as an example.

> 2. Our current production server versions is 9.1 and 9.6.
> Do this versions support returning of tuplestore?

Works since Postgres 7.3 if I recall correctly.

> 3. Currently my function defined as "RETURNS SETOF".
> Does definition of the function need to be changed if I rewrite code to
> return tuplestore?

No

HTH,

Joe

--
Crunchy Data - http://crunchydata.com
PostgreSQL Support for Secure Enterprises
Consulting, Training, & Open Source Development

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Abraham, Nikhil (COR), Vodafone Idea 2019-07-05 12:35:43 Unavailability of Jar for connectivity in Postgres
Previous Message Peter J. Holzer 2019-07-05 11:50:01 Re: Why does jsonb_set() remove non-mentioned keys?