pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Joe Conway <mail@joeconway.com>
To: Andrey Sychev <andrey.sychev@cifrasoft.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-general@lists.postgresql.org
Subject: Re: Error: rows returned by function are not all of the same row type
Date: Fri, 5 Jul 2019 08:15:43 -0400
Message-ID: <a25731e4-cf4d-27c2-2a7a-a0fe6ec64d82@joeconway.com> (raw)
In-Reply-To: <123684459.20190705133903@cifrasoft.com>
References: <851561973.20190704162046@cifrasoft.com>
	<28764.1562251122@sss.pgh.pa.us>
	<123684459.20190705133903@cifrasoft.com>

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

Attachments:

  signature.asc (application/pgp-signature, 832B) download

view thread (5+ messages)  latest in thread

Message-ID: <a25731e4-cf4d-27c2-2a7a-a0fe6ec64d82@joeconway.com>
Permalink:  ../a25731e4-cf4d-27c2-2a7a-a0fe6ec64d82@joeconway.com/
Also on:    postgresql.org/message-id/a25731e4-cf4d-27c2-2a7a-a0fe6ec64d82@joeconway.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: mail@joeconway.com, andrey.sychev@cifrasoft.com, tgl@sss.pgh.pa.us
  Subject: Re: Error: rows returned by function are not all of the same row type
  In-Reply-To: <a25731e4-cf4d-27c2-2a7a-a0fe6ec64d82@joeconway.com>
  References: <851561973.20190704162046@cifrasoft.com> <28764.1562251122@sss.pgh.pa.us> <123684459.20190705133903@cifrasoft.com> <a25731e4-cf4d-27c2-2a7a-a0fe6ec64d82@joeconway.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox