pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Joe Conway <mail@joeconway.com>
To: Franco Bruno Borghesi <franco@akyasociados.com.ar>
Cc: list@racistnames.com
Cc: pgsql-sql@postgresql.org
Subject: Re: returning composite types.
Date: Sat, 29 Mar 2003 08:49:15 -0800
Message-ID: <3E85CE8B.3010700@joeconway.com> (raw)
In-Reply-To: <200303291320.05734.franco@akyasociados.com.ar>
References: <200303282020.25997.franco@akyasociados.com.ar>
	<3E84E983.10206@racistnames.com>
	<200303291320.05734.franco@akyasociados.com.ar>

Franco Bruno Borghesi wrote:
> ok, soy you're telling me that the only way to return a composite type is 
> using a set of them, even if I know my function will allways return 1 record.

Try this:

create type foo as (f1 int, f2 text);
create or replace function retfoo(int, text) returns foo as '
  declare
   result foo%ROWTYPE;
  begin
   select into result $1, $2;
   return result;
  end;
' language 'plpgsql';

regression=# select * from retfoo(2,'b');
  f1 | f2
----+----
   2 | b
(1 row)

Joe




view thread (7+ messages)  latest in thread

Message-ID: <3E85CE8B.3010700@joeconway.com>
Permalink:  ../3E85CE8B.3010700@joeconway.com/
Also on:    postgresql.org/message-id/3E85CE8B.3010700@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 using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: mail@joeconway.com, franco@akyasociados.com.ar, list@racistnames.com
  Subject: Re: returning composite types.
  In-Reply-To: <3E85CE8B.3010700@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