Re: [GENERAL] How to handle nested record data.

2012-05-30 Thread Sergey Konoplev
On Wed, May 30, 2012 at 9:03 AM, yi huang wrote: > It turns out i also need to define a type for the result record of `foo`, > because record can't reveal the structure of the result (it complains: > record "r" has no field "somerow"). > I have to created this type: > >   create type foo_result as

Re: [GENERAL] How to handle nested record data.

2012-05-29 Thread Pavel Stehule
2012/5/30 yi huang : > On Wed, May 30, 2012 at 11:21 AM, Pavel Stehule > wrote: >> >> Hello >> >> create or replace function call_foo() >> returns void as $$ >> declare r record; >> begin >>  r := foo('Hello'); >>  raise notice ''% %', r.somerow, r.otherinfo; >> end; >> $$ language plpgsql; > > >

Re: [GENERAL] How to handle nested record data.

2012-05-29 Thread yi huang
On Wed, May 30, 2012 at 11:21 AM, Pavel Stehule wrote: > Hello > > create or replace function call_foo() > returns void as $$ > declare r record; > begin > r := foo('Hello'); > raise notice ''% %', r.somerow, r.otherinfo; > end; > $$ language plpgsql; > It turns out i also need to define a type

Re: [GENERAL] How to handle nested record data.

2012-05-29 Thread yi huang
On Wed, May 30, 2012 at 12:36 PM, yi huang wrote: > Thanks for you quick reply, but i need to take this returned row in > another pgsql function and do further processing. Sorry, i was misunderstood, i get it now, just use a record type, thanks very much. > > > On Wed, May 30, 2012 at 11:21 A

Re: [GENERAL] How to handle nested record data.

2012-05-29 Thread yi huang
Thanks for you quick reply, but i need to take this returned row in another pgsql function and do further processing. On Wed, May 30, 2012 at 11:21 AM, Pavel Stehule wrote: > Hello > > create or replace function call_foo() > returns void as $$ > declare r record; > begin > r := foo('Hello'); >

Re: [GENERAL] How to handle nested record data.

2012-05-29 Thread Pavel Stehule
Hello create or replace function call_foo() returns void as $$ declare r record; begin r := foo('Hello'); raise notice ''% %', r.somerow, r.otherinfo; end; $$ language plpgsql; regards Pavel 2012/5/30 yi huang : > I'm porting a oracle function to postgresql, which has signature like this: >

[GENERAL] How to handle nested record data.

2012-05-29 Thread yi huang
I'm porting a oracle function to postgresql, which has signature like this: FUNCTION foo ( seq IN varchar , somerow OUT SomeTable , otherinfo OUT varchar ) It's easy to port this function itself to postgresql, but i have problem to execute this function and assign the result