Re: [GENERAL] SQL plan in functions

2008-12-18 Thread Raymond O'Donnell
On 18/12/2008 12:40, Julius Tuskenis wrote: > Yes, Raymond - I know how to return record set in function using FOR, > but since version 8.3 there is a option - using RETURN QUERY SELECT > something FROM somewhere;. So if it works for SELECT why should it not > work for EXECUTE ? Oh - I didn't know

Re: [GENERAL] SQL plan in functions

2008-12-18 Thread Julius Tuskenis
Yes, Raymond - I know how to return record set in function using FOR, but since version 8.3 there is a option - using RETURN QUERY SELECT something FROM somewhere;. So if it works for SELECT why should it not work for EXECUTE ? Julius Tuskenis Raymond O'Donnell rašė: On 18/12/2008 12:12, Ju

Re: [GENERAL] SQL plan in functions

2008-12-18 Thread Raymond O'Donnell
On 18/12/2008 12:12, Julius Tuskenis wrote: > While experimenting I found that if I wright FOR rec IN EXECUTE 'my sql' > LOOP .. its OK, but If I wright RETURN QUERY EXECUTE 'my sql' I get > syntax error. Is it a bug? No, it's a syntax error. :-) You need to do something like this to return

Re: [GENERAL] SQL plan in functions

2008-12-18 Thread Julius Tuskenis
Thank you Andreas and Grzegorz. It worked! While experimenting I found that if I wright FOR rec IN EXECUTE 'my sql' LOOP .. its OK, but If I wright RETURN QUERY EXECUTE 'my sql' I get syntax error. Is it a bug? Julius Tuskenis A. Kretschmer rašė: In response to Julius Tuskenis :

Re: [GENERAL] SQL plan in functions

2008-12-18 Thread A. Kretschmer
In response to Julius Tuskenis : > Hello, list. > > I have a function witch returns record set. What troubles me is that > depending on parameters I pass to this function the execution time > varies greatly. On the other hand if I execute the query (not the > function) with pgAdmin - it gives

Re: [GENERAL] SQL plan in functions

2008-12-18 Thread Grzegorz Jaśkiewicz
On Thu, Dec 18, 2008 at 9:18 AM, Julius Tuskenis wrote: > Hello, list. > > I have a function witch returns record set. What troubles me is that > depending on parameters I pass to this function the execution time varies > greatly. On the other hand if I execute the query (not the function) with >

[GENERAL] SQL plan in functions

2008-12-18 Thread Julius Tuskenis
Hello, list. I have a function witch returns record set. What troubles me is that depending on parameters I pass to this function the execution time varies greatly. On the other hand if I execute the query (not the function) with pgAdmin - it gives results quickly. In previous post You helpe