greenplum-db/plcontainer

WRONG type with prepared statement

BaiShaoqi opened this issue · 2 comments

Expected behavior

INFO:  {'val': False}
CONTEXT:  PL/Python function "test_prep_bool_output"
 test_prep_bool_output
-----------------------
 f
(1 row)

Actual behavior

INFO:  {'val': 0}
 test_prep_bool_output
-----------------------
 f
(1 row)

Step to reproduce the behavior

CREATE OR REPLACE FUNCTION test_prep_bool_output() RETURNS bool
AS $$
# container: plc_python_shared
plan = plpy.prepare("SELECT $1 = 1 AS val", ['int'])
rv = plpy.execute(plan, [0], 5)
plpy.info(rv[0])
return rv[0]['val']
$$ language plcontainer;

SELECT test_prep_bool_output();

We have created an issue in Pivotal Tracker to manage this. Unfortunately, the Pivotal Tracker project is private so you may be unable to view the contents of the story.

The labels on this github issue will be updated when the story is started.

Lack of process of conversion of Bool in PLContainer yet.
Need to add PLyObject_ToBool() support.