Terence Kearns wrote:
Looking at the datatypes you can RETURN, it doesn't seem that there is a way to return a recordset

I tried
RETURNS SETOF RECORD
but that doesn't work

I even tried
RETURNS SETOF fooTable%ROWTYPE

What I would like to do is not that simple, I need to be able to build/declare a record definition with an arbitary list of columns and then return a set of that record which has it's values populated by queries and calculations inside the procedure.

Declare your datatype (CREATE TYPE ...) and return a SETOF that. What you can't do is declare your datatype inside your function. Clearly PostgreSQL needs to know what type is being returned while parsing the function, so you can't have a "dynamic type" (if such an idea has any meaning at all).


--
  Richard Huxton
  Archonet Ltd

---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
     joining column's datatypes do not match

Reply via email to