Обсуждение: passing parameters by reference

Поиск
Список
Период
Сортировка

passing parameters by reference

От
Sibtay Abbas
Дата:
hello all

as i have mentioned this before, as part of my academic project
i am required to make modifications in postgresql.

One of my tasks includes allowing plpgsql functions to pass parameters by
reference. For this purpose I have been digging in the code for plpgsql 
and postgresql for 2 days now but i am not able to find any thing tangible.

The first thing which i would love to clarify and would be very gratefull if
anyone can help me in this, is that to achieve this am i required to
make modifications
in plpgsql or postgresql codebase itself?

To achieve this my first approach was to make modifications in
function call manager where we fill the
FmgrInfo and FunctionCallInfo structures for a function. There we can
get the references of the Datums actually
passed and assign it to fcinfo.arg[0]

(i am refering to the "Datum DirectFunctionCall1(PGFunction func,
Datum arg1)" function in fmgr.c and i am quite
sure that this approach is wrong)

If anyone can point out the area (in terms of functions or .c files)
where i should start
doing my research in this context it would do wonders to me.

Thank you


P.S : I have discovered that you cannot assign values to function
parameters inside the function,
but i have managed to get pass this restriction by setting the
"isconst" field of function parameters
to false, in the "do_compile" function of plpgsql. This way users will
have write access
to function parameters.


Re: passing parameters by reference

От
Tom Lane
Дата:
Sibtay Abbas <sibtay@gmail.com> writes:
> One of my tasks includes allowing plpgsql functions to pass parameters by
> reference.

What do you envision the context of this to be?  You certainly can't
suppose that it's sane forSELECT foo(col) FROM tab;
to modify the table column.
        regards, tom lane