Greenplum:尚不支持从 segDB 执行 SQL 语句的函数

发布于 2024-10-10 09:24:36 字数 848 浏览 4 评论 0原文

当我尝试从 SNE GP 版本中的一个表上设置的插入触发器调用函数时,出现此错误:

ERROR:  Functions that execute SQL statements from the segDBs are not yet supported (spi.c:203)  (seg0 localhost:50001 pid=5504)
DETAIL:  
  SQL statement "SELECT DISTINCT min(zasn) FROM zeusasn WHERE zasn IN (SELECT asn FROM asntable where ip >>= '10.29.249.121')"
PL/pgSQL function "eptriggerfn" line 5 at SQL statement

********** Error **********

ERROR: Functions that execute SQL statements from the segDBs are not yet supported (spi.c:203)  (seg0 localhost:50001 pid=5504)
SQL state: XX000
Detail: 
  SQL statement "SELECT DISTINCT min(zasn) FROM zeusasn WHERE zasn IN (SELECT asn FROM asntable where ip >>= '10.29.249.121')"
PL/pgSQL function "eptriggerfn" line 5 at SQL statement

可能是什么原因造成的?触发器+函数与同一数据库中的另一个表完美配合。

提前致谢!

平均值, 基兰

I get this error when I try to call a function from an Insert Trigger set on one of my tables in the SNE GP Edition:

ERROR:  Functions that execute SQL statements from the segDBs are not yet supported (spi.c:203)  (seg0 localhost:50001 pid=5504)
DETAIL:  
  SQL statement "SELECT DISTINCT min(zasn) FROM zeusasn WHERE zasn IN (SELECT asn FROM asntable where ip >>= '10.29.249.121')"
PL/pgSQL function "eptriggerfn" line 5 at SQL statement

********** Error **********

ERROR: Functions that execute SQL statements from the segDBs are not yet supported (spi.c:203)  (seg0 localhost:50001 pid=5504)
SQL state: XX000
Detail: 
  SQL statement "SELECT DISTINCT min(zasn) FROM zeusasn WHERE zasn IN (SELECT asn FROM asntable where ip >>= '10.29.249.121')"
PL/pgSQL function "eptriggerfn" line 5 at SQL statement

What can be the cause of this? Triggers + functions are working perfectly fine with another table in the same DB.

Thanks in advance!

Rgds,
Kiran

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

东走西顾 2024-10-17 09:24:36

由于Greenplum跨多个节点进行分布式处理,查询中的查询无法利用完整的处理能力,因此不支持。

当我们进行切换时,我们遇到了类似的问题:

select      *,
            country_name(country_id)
from        sales
where       country_id in (224, 105);

函数 country_name() 基本上对每个 id 进行了子查询以获取国家/地区名称。所以我们不得不将查询更改为:

select      *,
            c.country_name
from        sales
left join   country as c using (country_id)
where       country_id in (224, 105);

...,问题就解决了。我知道这看起来工作量很大,但好处是值得的。

Because Greenplum does distributed processing across multiple nodes, a query within a query cannot utilise the full processing capability, so it is not supported.

When we made the switch we had a similar problem:

select      *,
            country_name(country_id)
from        sales
where       country_id in (224, 105);

The function country_name() basically did a sub query for each id to get the country name. So we had to change the query to:

select      *,
            c.country_name
from        sales
left join   country as c using (country_id)
where       country_id in (224, 105);

... and the problem was solved. I know it seems like a lot of work, but the benefits are worth it.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文