问题标签 [plperl]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
100 浏览

postgresql - 在 Postgres 的 plperl 函数中访问 c​​urrent_settings 函数

我正在 Postgres 中编写我的第一个 plperl 函数,我需要访问 current_settings() 区域中的一些值(通过使用该调用)——我想知道这样做的最佳解决方案是什么?

在 plpgsql 中,我可以执行以下操作:

只是想知道在 Perl plperl 脚本中访问诸如 current_setting 之类的系统函数的等价物。

谢谢!

0 投票
1 回答
401 浏览

postgresql - 使用“plperl”通过 plperl pg_available_extensions 从 PostgreSQL 过程/函数调用 RESTful Web 服务

我想使用“plperl”从 PostgreSQL 过程/函数调用 RESTful Web 服务。我不能“不”使用 plperlu、plpython2u、JOOQ 或 Hibernate。

因此,我想使用以下网站中的“类似”“plperlu”PostgreSQL-proc 示例,但对于 plperl(或类似 plperl 的东西,它是 'not' plperlu、'not' plpython2u、'not' JOOQ 和 'not ' Hibernate): 从 PostgreSQL 过程/函数调用 RESTful Web 服务

我尝试了以下代码,但它不适用于 plperl,因为它可能仅适用于 plperlu 而不适用于 plperl(但我无法让 AWS 在我的 AWS-PostgreSQL-RDS 上安装 plperlu):

这是我得到的错误,它看起来“可能”是一个权限错误(但可能是 plperl vs plperlu):SQL 错误 [42601]:错误:无法在第 2 行将 REST/Client.pm 加载到 plperl 中。开始失败--编译在第 2 行中止。其中:编译 PL/Perl 函数“get”

以下是可供我在 AWS-PostgreSQL-RDS 中使用的所有“pg_available_extensions”的列表:

0 投票
0 回答
64 浏览

postgresql - Global variables implementation using plperl/plpython in postgres is throwing out of memory

We are actually migrating db from oracle to postgres. We are using postgreSQL 11. So the packages are converted to procedures/functions accordingly.

For global variables implementation we used the local configuration setting as below

However, these values are becoming empty if it goes into exception block and we needed the value to be available in the exception block to proceed with some other logic on failure.

So we took an approach of using global variables using extension plperl/plpython as per below,

plpython as below

We set the value and retrieve the value like,

The procedure that we are calling has a for loop inside and inreturn calls many other procedures which will set a total of approx 270 of such global variables altogether for each loop. The value of the global variables will be updating to the new value for the same 270 variables that we already created in the first loop. This has to happen for around 300,000 rows in the for loop.

However with this implementation, the memory consumption is going very high and at one point it reaches an out of memory state and stopping at around 157000th row.

I do not know much of perl or python but based on things i understood from online i have added undef() and del for perl and python respectively which would release the memory. However it is not happening so.

We also took the address of the variable set to see if it is updating on the same address or taking new memory address on each invocation. It is updating the value on the same address when the variable got created.

But the memory keeps accumulating overtime until it uses all of the available RAM and throw error as out of memory.

If anyone can help me understanding on what i have done wrong or what i can change to make it work fine it would be of great help. Thanks in advance.

UPDATE: The issue was because of using Procedures. We changed the code to Functions and the memory consumption issue is not there. I am still yet to findout why there is such a massive difference in using procedures vs functions.

0 投票
1 回答
51 浏览

postgresql - 我如何在 PostgreSQL 中调用 restFull API

我正在使用 PostgreSQL 12.6,由 Visual C++ build 1914 编译,在 Windows Server 上为 64 位。并且想知道如何在 postgres 中使用 python 或 perl 调用 RestFull API。

我在从 postgres 调用 restFull API 方面相对较新,所以我需要一个关于如何执行此操作的分步指南。

提前致谢。

0 投票
0 回答
40 浏览

postgresql - 如何在 Postgres 中使用 plperl 解决“错误:被操作掩码捕获”

我在 PostgreSQL 数据库中有一个表,它使用 bytea 字段来存储浮点和双精度数组。我有一个使用 plpython3u 扩展将列转换为双精度数组的函数。

我正在寻找使用 plperl 扩展的替代功能。我尝试了以下方法:

当我尝试构建函数时,出现此错误:

错误:第 11 行的操作掩码捕获的“解包”。

任何想法如何纠正这个?

0 投票
1 回答
200 浏览

postgresql - 创建语言 plperlu; 尽管安装了 postgresql-plperl-12,但仍然失败

我在一个 Ubuntu 派生系统上(特别是来自 System76 的 pop_os)。我正在尝试安装 Bucardo,但它似乎失败了,因为plperlu它不起作用。

psql提示中:

但是,运行:

和:

我确实安装了postgresql-plperl-12软件包:

我能找到的所有相关错误都与未安装相关软件包或未在 postgres 中创建的语言有关,所以我有点受阻。该CREATE LANGUAGE语句的错误似乎表明 Postgres 正在寻找一个没有扩展名的文件,但我不确定这是否可以通过简单mv的 . 修复,如果可以,向谁报告包错误。


编辑:由@AdrianKlaver 的评论提示:

...现在为什么要在 /usr/share/postgresql/ 10 / 中查找?我可能会误解,但我有:

plperlu.control确实存在于/usr/share/postgresql/12/extension/……但SELECT version()确实是 PostgreSQL 10.10……所以在更新过程中某个地方出了问题。是否具有psql与正在运行的实际 postgres 不同的版本会导致问题?