context in plpgsql functions

Поиск
Список
Период
Сортировка
От Gianni Mariani
Тема context in plpgsql functions
Дата
Msg-id 3EC53215.4050309@mariani.ws
обсуждение исходный текст
Ответы Re: context in plpgsql functions  (Ian Barwick <barwick@gmx.net>)
Re: context in plpgsql functions  (elein <elein@varlena.com>)
Список pgsql-general
I've been using PostgreSQL 7.3.2.

What, if any, way is there to share a context (global rowtype variable)
between plpgsql functions ?

Can row types be passed as parameters ?  (I seem to have had trouble
doing that)

e.g.

A transaction that looks like:

BEGIN;
select FindContext(5432);
select SomeRandomFunction('111');
COMMIT;


The functions would look somthing like:

CREATE or replace FUNCTION FindContext(int4) RETURNS int4 AS
'
DECLARE
    w_key alias for $1;
    w_context context%ROWTYPE;
BEGIN

    SELECT INTO w_context * FROM contecxt WHERE key = w_key;

    -- I want to access w_context in a different method

    RETURN 1;

END;
'
LANGUAGE 'plpgsql';


CREATE or replace FUNCTION SomeRandomFunction(int4) RETURNS int4 AS
'
DECLARE
    w_stuff alias for $1;
    w_context context%ROWTYPE; -- ??????????????
BEGIN

    update sometable set key = w_context.key where yadda = w_stuff;

    RETURN 1;

END;
'
LANGUAGE 'plpgsql';




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

Предыдущее
От: "Chris Palmer"
Дата:
Сообщение: Re: priority on a process
Следующее
От: ahoward
Дата:
Сообщение: 7.3.2, pam, on Linux 2.4.18-18.7.x i686