greenplum-db/plcontainer

ERROR no recursive traceback for nested plpgsql call

BaiShaoqi opened this issue · 2 comments

Expected behavior

ERROR:  plpy.SPIError: division by zero
CONTEXT:  Traceback (most recent call last):
  PL/Python function "python_traceback", line 11, in <module>
    first()
  PL/Python function "python_traceback", line 3, in first
    second()
  PL/Python function "python_traceback", line 6, in second
    third()
  PL/Python function "python_traceback", line 9, in third
    plpy.execute("select sql_error()")
PL/Python function "python_traceback"

Actual behavior

ERROR:  division by zero
CONTEXT:  SQL statement "select 1/0"
PL/pgSQL function "sql_error" line 2 at SQL statement
SQL statement "select sql_error()"

Step to reproduce the behavior

CREATE OR REPLACE FUNCTION python_traceback() RETURNS void AS $$
# container: plc_python_shared
def first():
  second()

def second():
  third()

def third():
  plpy.execute("select sql_error()")

first()
$$ LANGUAGE plcontainer;

CREATE OR REPLACE FUNCTION sql_error() RETURNS void AS $$
begin
  select 1/0;
end
$$ LANGUAGE plpgsql;

SELECT python_traceback();

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.

Python call stack in container is not send to QE side.
This is a good feature to help user to debug plpython code.