pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: PFC <lists@boutiquenumerique.com>
To: Marc G. Fournier <scrappy@postgresql.org>
To: George Weaver <gweaver@shaw.ca>
Cc: pgsql-sql@postgresql.org
Subject: Re: PL/PgSQL - returning multiple columns ...
Date: Thu, 03 Feb 2005 19:15:04 +0100
Message-ID: <opslmvnew2th1vuj@musicbox> (raw)
In-Reply-To: <20050203124751.C62562@ganymede.hub.org>
References: <20050202170643.R27579@ganymede.hub.org>
	<00c701c50978$f01c9e20$6400a8c0@Dell4500>
	<20050203124751.C62562@ganymede.hub.org>

On Thu, 3 Feb 2005 12:48:11 -0400 (AST), Marc G. Fournier  
<scrappy@postgresql.org> wrote:

>
> Perfect, worked like a charm ... but the RETURNS still needs to be a  
> SETOF, other then that, I'm 'away to the races' ... thanks :)

	No SETOF necessary :

CREATE TYPE mytype AS ( number INTEGER, blah TEXT );

CREATE OR REPLACE FUNCTION myfunc( INTEGER ) RETURNS mytype LANGUAGE  
plpgsql AS  $$ DECLARE _retval mytype; BEGIN _retval.number=$1;  
_retval.blah='yeah'; RETURN _retval; END;$$;

SELECT myfunc(22);
   myfunc
-----------
  (22,yeah)
(1 ligne)

SELECT * FROM myfunc(22);
  number | blah
--------+------
      22 | yeah
(1 ligne)



view thread (4+ messages)

Message-ID: <opslmvnew2th1vuj@musicbox>
Permalink:  ../opslmvnew2th1vuj@musicbox/
Also on:    postgresql.org/message-id/opslmvnew2th1vuj@musicbox

 · 

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: lists@boutiquenumerique.com, scrappy@postgresql.org, gweaver@shaw.ca
  Subject: Re: PL/PgSQL - returning multiple columns ...
  In-Reply-To: <opslmvnew2th1vuj@musicbox>

* 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