Re: how do you call one pltcl function from another?
От | Jan Wieck |
---|---|
Тема | Re: how do you call one pltcl function from another? |
Дата | |
Msg-id | 200011080956.EAA07041@jupiter.jw.home обсуждение исходный текст |
Ответ на | how do you call one pltcl function from another? ("Jonathan Ellis" <jellis@advocast.com>) |
Список | pgsql-general |
Jonathan Ellis wrote: > I tried mailing this last week, but I think it didn't get sent: > > I defined a procedure > > CREATE FUNCTION meta_class (varchar) RETURNS varchar AS ' > ... > ' LANGUAGE 'pltcl'; > > This works fine. But when I want to call it from another tcl procedure I > get errors: > bf2=# CREATE FUNCTION foo (varchar) RETURNS varchar AS ' > return [meta_class $1] > ' LANGUAGE 'pltcl'; > > bf2'# bf2'# CREATE > > bf2=# bf2=# select foo(class) from weapon_Types; > ERROR: pltcl: invalid command name "meta_class" > > This IS possible -- isn't it? It is. The problem is that the internal name of the proc in the Tcl interpreter doesn't have to do with the function name. Due to possible function overloading (multiple functions with same name but different arguments) this is impossible. You need to call it via SPI like spi_exec "select meta_class($1) as retval" return $retval Jan -- #======================================================================# # It's easier to get forgiveness for being wrong than for being right. # # Let's break this rule - forgive me. # #================================================== JanWieck@Yahoo.com #
В списке pgsql-general по дате отправления: