Search Postgresql Archives

Re:

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Nigel Horne schrieb:
On Mon, 2005-08-22 at 14:49, Tino Wildenhain wrote:

Nigel Horne schrieb:

On Fri, 2005-08-19 at 16:34, A. Kretschmer wrote:


am  19.08.2005, um 15:58:20 +0100 mailte Nigel Horne folgendes:


I can't work out from that how to return more than one value.

17:35 < rtfm_please> For information about srf
17:35 < rtfm_please> see http://techdocs.postgresql.org/guides/SetReturningFunctions
17:35 < rtfm_please> or http://www.postgresql.org/docs/current/static/xfunc-sql.html#AEN28835


How does that help with my problem? I seems to discuss returning more
than one row of a table which is not the question I asked.


try to tell your questions more precisely :-)


I want to return more than one value from a procedure, e.g. a string and
an integer.


I think you want to return a record or tabletype.


Not really, since those values could be computed on the fly, they may
not be values in a database.


IIrc you got the answers to that already :-)


Nope.

Well, I was sure. And here it is again (from Tom Lane: )

--- cite ---
You've misunderstood this completely.  We are not storing anything
essential in the table, we're just using its rowtype to describe the
function's composite-type result.

Personally I would have written the example using a composite type
to make this more clear:

CREATE TYPE test_func_type AS (id int, name text);

CREATE FUNCTION test_func() RETURNS SETOF test_func_type AS $$
  SELECT 1, 'me' UNION ALL SELECT 2, 'you'
$$ LANGUAGE sql;

select * from test_func();
 id | name
----+------
  1 | me
  2 | you
(2 rows)

--- cite ---

When this isnt what you want, you are out of options I fear.
Maybe you would write an example of how your hypotetical
function should act?

Regards
Tino

---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux