Re: AW: [HACKERS] Re: PL/PgSQL discussion

Поиск
Список
Период
Сортировка
От jwieck@debis.com (Jan Wieck)
Тема Re: AW: [HACKERS] Re: PL/PgSQL discussion
Дата
Msg-id m0yG2BQ-000BFRC@orion.SAPserv.Hamburg.dsh.de
обсуждение исходный текст
Ответ на Re: AW: [HACKERS] Re: PL/PgSQL discussion  (jwieck@debis.com (Jan Wieck))
Список pgsql-hackers
I wrote:
>
>
> Andreas Zeugswetter wrote:
> >
> > >From my experience, it *** is *** impossible. I would be glad if somebody
> > told me different, but to my understanding the doc is wrong here.
> >
> > Andreas
> >
> > >>     Currently  only  'null'  and  'single  value'.  The  executor
> > >>     doesn't  accept anything else for non-sql language functions.
> > >>     PL functions are treated by the executor like 'C'  functions.
> > >
> > >Actually what I understood from the docs was thatit is 'terribly complicated' and 'beyond the
> > >scope of this tutorial', but not impossible ;)
>
>     The executor could check in ExecMakeFunctionResult() that the
>     function  is  a   PL   function   (simply   by   looking   at
>     fcache->func.fn_plhandler).   So  it  is  possible  that  the
>     Executor    treats     PL     functions     somewhat     like
>     postquel_function().

    That  way  it might be possible. The call interface to the PL
    handler must be extended and the PL handler  cannot  use  SPI
    any  more.   The memory management of SPI makes it impossible
    to return from the function and  resume  later.  Leaving  the
    function  while  connected  to SPI would possibly corrupt the
    SPI stack.

    And the handling of functions returning tuples  is  really  a
    mess.   The executor calls postquel_function() first to get a
    tuple table slot, and then again for each attribute used  via
    nested dot expression. It's up to the function itself then to
    create the correct projection from the functions  targetlist.

    And there must be something in the parser/optimizer too.  For
    an 'sql' function, the fcache has a prepared tuple table slot
    on the actual call. But for 'C' or 'PL' functions, it is NULL
    on the call to ExecMakeFunctionResult().

    For now, I'll let the PL interface as is and  try  to  finish
    PL/pgSQL  in  the trigger area. Someday I'll get back to here
    and give it a real try to enable tuples and  sets  as  return
    from  functions.  That  all is far too much work for me right
    now cause the next 4 weeks I have to do some homework (bought
    a new house and that's built now).


Jan

--

#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me.                                  #
#======================================== jwieck@debis.com (Jan Wieck) #

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

Предыдущее
От: Dwayne Bailey
Дата:
Сообщение: DEC Alpha and HAVE_INT_TIMEZONE
Следующее
От: Michael Meskes
Дата:
Сообщение: Re: AW: [HACKERS] Begin statement again