Reference to a hash as argument for a plperl-function

Reference to a hash as argument for a plperl-function

am 13.07.2007 08:41:06 von mr16

Hello,

is it possible to pass a reference to a hash from my perl-script as
argument to a plperl-function in a Postgresql-database?

E.g. lets take a function like this:
CREATE FUNCTION repl (INT,HASHREF) RETURNS TEXT AS '
return $$_[1]{$_[0]};
' LANGUAGE plperl;

In my Perl-programm I would do the query via DBD::Pg
SELECT repl(col1,'\%hvar') FROM table;
and get back the hashvalue that is represented by the key "col1" taken
from "table" (or as coding: $hvar{col1} )

I tried that solution without success. Do I have just an error in this
programm or is it a principally problem?

Thank you very much for answering

Michael

Re: Reference to a hash as argument for a plperl-function

am 13.07.2007 19:26:27 von Greg

-----BEGIN PGP SIGNED MESSAGE-----
Hash: RIPEMD160


> is it possible to pass a reference to a hash from my perl-script as
> argument to a plperl-function in a Postgresql-database?

No: the hash is in the memory of your DBD::Pg script, and is not
available from the Postgres process (which has perl inside it to
run Pl/Perl).

- --
Greg Sabino Mullane greg@turnstep.com
End Point Corporation
PGP Key: 0x14964AC8 200707131325
http://biglumber.com/x/web?pk=2529DF6AB8F79407E94445B4BC9B90 6714964AC8
-----BEGIN PGP SIGNATURE-----

iD8DBQFGl7WivJuQZxSWSsgRA/mEAKDeo02/DD+oi3z79tFhlmgmZ3dYhgCg 3+iq
zK8yZCTUPdA9fuxpmkKvviU=
=6P61
-----END PGP SIGNATURE-----