Re: Is there a way to use "pack" in pl/perl without resorting to pl/perlu?

Поиск
Список
Период
Сортировка
От Herouth Maoz
Тема Re: Is there a way to use "pack" in pl/perl without resorting to pl/perlu?
Дата
Msg-id 7216CCB6-CDA2-4E1B-9BDE-ECD912CD7854@unicell.co.il
обсуждение исходный текст
Ответ на Re: Is there a way to use "pack" in pl/perl without resorting to pl/perlu?  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: Is there a way to use "pack" in pl/perl without resorting to pl/perlu?  ("Greg Sabino Mullane" <greg@turnstep.com>)
Список pgsql-general
Thanks. I was hoping there was a way to enable individual operators through the postgresql configuration file or something.

Anyway, I replaced the functionality with $content =~ s/([a-fA-F0-9]{2})/chr(hex($1))/eg; which seems to be doing the same thing as unpack( "H*", $content ), which is basically what I needed for the time being. I suspect it's less efficient than unpack, and I hope the function I created won't be too slow for use inside a trigger.

Thanks,
Herouth

On 12/09/2012, at 17:47, Tom Lane wrote:

Herouth Maoz <herouth@unicell.co.il> writes:
I created a function that does some heavy string manipulation, so I needed to use pl/perl rather than pl/pgsql.
I'm not experienced in perl, but the function works well when used as an independent perl subroutine - it depends only on its arguments. I use the Encode package (in postgresql configuration).

But my use of the "pack" function causes a Safe error. Apparently "pack" and "unpack" are in the operator mask.

Is there any way to remove them from that mask?

My recollection is that they're intentionally excluded because they
would otherwise be security holes --- there are some format codes that
allow direct access to memory, or something like that.

regards, tom lane


--
חרות מעוז
יוניסל פתרונות סלולריים מתקדמים
☎ 03-5181717 שלוחה 742

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

Предыдущее
От: "Devrim GUNDUZ"
Дата:
Сообщение: Re: CentOS initd Script
Следующее
От: Edson Richter
Дата:
Сообщение: Re: Compressed binary field