gpdb: ERROR: could not compile PL/Python function

Greenplum version or build

6X_STABLE

Expected behavior

No error

Actual behavior

 ERROR:  could not compile PL/Python function "test_return_table" (plpy_elog.c:121)

Step to reproduce the behavior

set check_function_bodies = false; -- This is important, doesn't repro  without it
DROP FUNCTION test_return_out_setof_record(s text, OUT first text, OUT second int4);
CREATE FUNCTION test_return_out_setof_record(s text, OUT first text, OUT second int4)
RETURNS setof record AS $$
  exec('y = ' + s)
  return y
$$ language plpythonu;

DROP FUNCTION test_return_table(text);
CREATE FUNCTION test_return_table(s text) RETURNS TABLE(first text, second int4)
AS $$
  exec('y = ' + s)
  return y
$$ language plpythonu;

DROP TABLE gp_single_row;
CREATE TABLE gp_single_row(a int) distributed by (a);
insert into gp_single_row values(1);

-- Without this it doesn't repro.
SELECT (test_return_out_setof_record('[ ("value", 4), {"first": "test", "second": 2} ]')).*
FROM gp_single_row;

select test_return_table('[]') from gp_single_row; -- This errors out
select test_return_table('[]') from gp_single_row; -- This succeeds

About this issue

  • Original URL
  • State: open
  • Created 4 years ago
  • Comments: 22 (22 by maintainers)

Commits related to this issue

Most upvoted comments

Hi!

I am looking into this issue and I am able to reproduce it using the script provided by @l-wang on GPDB 6.21.1.

I will try to find the root cause and fix it.

Thanks @reductionista , I can reproduce now. We must start a new session and then run the first query immediately. I will start to investigate it.