Function Returning a Set of Composite Value

Поиск
Список
Период
Сортировка
От Nikhil teltia
Тема Function Returning a Set of Composite Value
Дата
Msg-id 276596.90540.qm@web110406.mail.gq1.yahoo.com
обсуждение исходный текст
Список pgsql-novice
Hi All ,
 
  I have a function f_wrapper(seq,pat) which returns a composite value of type (int,int[][]);
I am aware that I can run a query somthing like this to get it working

select * from f_wrapper('XYZ,'X') as m1(mid int,match int[][]);

but I want to pass another table column as parameter to function. - select f_wrapper( t.seq,'X') from t_sequence t;
this return result which looks like -

(0,"{{0,2,2}}")
(1,"{{10,2,2}}")

when I try to parse this result in following way -
select f_wrappwe(t.seq,'X') frm t_sequence t as m1(mid int,match int[][]) ; I get following syntax error

ERROR:  syntax error at or near "int"
LINE 1: ...f_wrapper(seq,'MK') from nik_small_file as m1(mid int,match ...
                                                                                                       ^
any idea why I am getting this error or what is the alternative to parse composite value in select column ?

my purpose is to to show some column from table+(result from f_wrapper function) but I am not able to parse f_wrapper result in required column without calling f_wrapper twice like this -
select (f_wrapper(seq,'MK')).mid , (f_wrapper(seq,'MK')).match from nik_small_file;

since my f_wrapper is going to be a heavy function so I can't afford to call it twice.
any suggestion regarding this will be helpful.

Regards,
Nikhil



Check out the all-new Messenger 9.0! Click here.

В списке pgsql-novice по дате отправления:

Предыдущее
От: rhubbell
Дата:
Сообщение: calculating elapsed times between timestamps
Следующее
От: Joe Conway
Дата:
Сообщение: Re: LATIN2->UTF8 conversation with dblink