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
"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
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
"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:
> "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
I have found that in many complex queries left join is exponentially
faster than a (not) exists clause.
I don't understand why, generally speaking, this is so frequently so
effective.
__
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam