Gregory Stark <[EMAIL PROTECTED]> writes:
> "Tom Lane" <[EMAIL PROTECTED]> writes:
>> Not quite --- it's just "returns setof record".
> I did test my example before posting it:
> postgres=# postgres=# CREATE or replace FUNCTION getfoo (IN int, OUT int, OUT
> int) returns setof record(int,int)AS
"Tom Lane" <[EMAIL PROTECTED]> writes:
> Gregory Stark <[EMAIL PROTECTED]> writes:
>> You're almost there:
>
>> CREATE FUNCTION getfoo (IN int, OUT int, OUT int) returns setof
>> record(int,int) AS $$
>> SELECT fooid, foosubid FROM foo WHERE fooid = $1;
>> $$ LANGUAGE SQL;
>
> Not quite --- it'
Gregory Stark <[EMAIL PROTECTED]> writes:
> You're almost there:
> CREATE FUNCTION getfoo (IN int, OUT int, OUT int) returns setof
> record(int,int) AS $$
> SELECT fooid, foosubid FROM foo WHERE fooid = $1;
> $$ LANGUAGE SQL;
Not quite --- it's just "returns setof record". The output column t
"Michele Petrazzo - Unipex srl" <[EMAIL PROTECTED]> writes:
> I try with:
> CREATE FUNCTION getfoo (IN int, OUT int, OUT int) AS $$
>SELECT fooid, foosubid FROM foo WHERE fooid = $1;
> $$ LANGUAGE SQL;
>
> but only one row returned...
You're almost there:
CREATE FUNCTION getfoo (IN int, OUT
Pavel Stehule wrote:
CREATE FUNCTION getfoo(int) RETURNS foo AS $$ SELECT fooid, foosubid
FROM foo WHERE fooid = $1 LIMIT 1; $$ LANGUAGE SQL;
this return only one value, I need all the values that return the query
or
CREATE FUNCTION getfoo(int) RETURNS SETOF foo AS $$ SELECT fooid,
foosubi
On 09/11/2007, Michele Petrazzo - Unipex srl <[EMAIL PROTECTED]> wrote:
> Hi all.
> I want that a function return a table rows (like the doc says at 33.4.4.
> SQL Functions as Table Sources), but I want the a function return only a
> few cols, so the same that I select into the func.
> Modifying th
Hi all.
I want that a function return a table rows (like the doc says at 33.4.4.
SQL Functions as Table Sources), but I want the a function return only a
few cols, so the same that I select into the func.
Modifying the doc example:
CREATE TABLE foo (fooid int, foosubid int, fooname text);
INSERT