plcontainer icon indicating copy to clipboard operation
plcontainer copied to clipboard

ERROR plpy.execute does not support attribute nrows

Open BaiShaoqi opened this issue 6 years ago • 2 comments

Expected behavior

  result_nrows_test
 -------------------
                  1
 (1 row)

Actual behavior

 ERROR:  PL/Container client exception occurred:
 DETAIL:
  Exception occurred in Python during function execution
  Traceback (most recent call last):
   File "<string>", line 5, in result_nrows_test
 AttributeError: 'list' object has no attribute 'nrows'

Step to reproduce the behavior

CREATE FUNCTION result_nrows_test(cmd text) RETURNS int AS $$
# container: plc_python_shared
result = plpy.execute(cmd)
return result.nrows()
$$ language plcontainer;

SELECT result_nrows_test($$SELECT 1$$);

BaiShaoqi avatar Jun 02 '18 15:06 BaiShaoqi