Re: Multiple return 'columns' from postgre pl/pgsql - Mailing list pgsql-novice

From Tom Lane
Subject Re: Multiple return 'columns' from postgre pl/pgsql
Date
Msg-id 21485.1091996770@sss.pgh.pa.us
Whole thread Raw
In response to Multiple return 'columns' from postgre pl/pgsql  (Steve Tucknott <steve@retsol.co.uk>)
Responses Re: Multiple return 'columns' from postgre pl/pgsql
List pgsql-novice
Steve Tucknott <steve@retsol.co.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

pgsql-novice by date:

Previous
From: Steve Tucknott
Date:
Subject: Multiple return 'columns' from postgre pl/pgsql
Next
From: Christian Emery
Date:
Subject: The best way to insert rows into multiple tables?