Re: [GENERAL] PostgreSQL Functions / PL-Language

2006-02-19 Thread Michael Fuhr
On Mon, Feb 20, 2006 at 02:36:04PM +0800, Jan Cruz wrote: > BTW I also got something like this: > > CREATE FUNCTION func2() RETURNS SETOF foo as $$ > DECLARE > row foo; > BEGIN > SELECT INTO ROW * from FOO; >return next foo; > END; > $$ LANGUAGE plpgsql STABLE; Please post the actual code i

Re: [GENERAL] PostgreSQL Functions / PL-Language

2006-02-19 Thread Jan Cruz
On 2/19/06, Michael Fuhr <[EMAIL PROTECTED]> wrote: On Sat, Feb 18, 2006 at 04:48:55PM +0800, Jan Cruz wrote:  CREATE TABLE foo (id integer, t text);INSERT INTO foo VALUES (1, 'one'); INSERT INTO foo VALUES (2, 'two'); Thanks for the correct syntaxing Mike. BTW I also got something like this: C

Re: [GENERAL] PostgreSQL Functions / PL-Language

2006-02-18 Thread Michael Fuhr
On Sat, Feb 18, 2006 at 04:48:55PM +0800, Jan Cruz wrote: > > > Why does my stored function returns only the first row of the query > > > instead of the whole set of query? > > > > Did you declare your function to return "setof " ? > > I did but I don't know if I have to iterate/loop and use "retur

Re: [GENERAL] PostgreSQL Functions / PL-Language

2006-02-18 Thread Jan Cruz
> Why does my stored function returns only the first row of the query instead > of the whole set of query?Did you declare your function to return "setof " ?I did but I don't know if I have to iterate/loop and use "return next setof_foo" or just use return next as it is.

Re: [GENERAL] PostgreSQL Functions / PL-Language

2006-02-18 Thread Martijn van Oosterhout
On Sat, Feb 18, 2006 at 04:10:13PM +0800, Jan Cruz wrote: > Correct me if I am wrong but SQL procedural language doesn't have support > for variable declarations? Correct, you'll need pl/pgsql for that. > Why does my stored function returns only the first row of the query instead > of the whole s

[GENERAL] PostgreSQL Functions / PL-Language

2006-02-18 Thread Jan Cruz
Correct me if I am wrong but SQL procedural language doesn't have support for variable declarations? And Why does my stored function returns only the first row of the query instead of the whole set of query? Kindly educate me :)