2

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

1 Answer 1

3

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.