Re: Multiple return 'columns' from postgre pl/pgsql

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Steve Tucknott <steve(at)retsol(dot)co(dot)uk>
Cc: PostGre <pgsql-novice(at)postgresql(dot)org>
Subject: Re: Multiple return 'columns' from postgre pl/pgsql
Date: 2004-08-08 20:26:10
Message-ID: 21485.1091996770@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Steve Tucknott <steve(at)retsol(dot)co(dot)uk> writes:
> Is there a way of doing:
> RETURNS INTEGER, CHAR(5), VARCHAR(200),.....
> IE return multiple values from a PL/PGSQL function?

You have to return a rowtype value.

There's an example in the 8.0devel docs:
http://developer.postgresql.org/docs/postgres/plpgsql-porting.html#PLPGSQL-PORTING-EX3

The example is making use of an 8.0-only feature (explicit names for
parameters) but otherwise I believe it would work in 7.4. Not sure
about pre-7.4.

BTW, the correct name of our software is PostgreSQL or informally
Postgres. No one associated with the project has ever called it
"Postgre". Pronounce it "post-gress" or "post-gress-cue-ell".

regards, tom lane

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Tom Lane 2004-08-09 00:27:05 Re: Error >>syntax error<< at >>$1<< at character 53
Previous Message Steve Tucknott 2004-08-08 19:00:56 Multiple return 'columns' from postgre pl/pgsql