问题描述:

Currently in case of error I have such traceback in psql for PL/Python procedure, that imports Python module and calls some function from it:

ERROR: AssertionError:

CONTEXT: Traceback (most recent call last):

PL/Python function "tempo_timeintervalset_contains", line 6, in <module>

TimeIntervalSet.from_json(timeintervalset))

PL/Python function "tempo_timeintervalset_contains", line 209, in __contains__

PL/Python function "tempo_timeintervalset_contains", line 106, in _walk

PL/Python function "tempo_timeintervalset_contains", line 41, in _evaluate

PL/Python function "tempo_timeintervalset_contains", line 200, in callback

PL/Python function "tempo_timeintervalset_contains", line 91, in __contains__

PL/Python function "tempo_timeintervalset_contains"

I've tried to set log_error_verbosity = verbose in postgresql.conf and set this environment variables PYTHONVERBOSE=1 PYTHONDEBUG=1. Nothing helped.

Who knows, how to actually set it to be more verbose if it's possible at all?

网友答案:

I know this is old, but I find this works well.

create function python_version()
returns text
language plpythonu
as $$

import sys
import traceback

try:
    return sys.version
except:
    error = sys.exc_info()[0]
    details = traceback.format_exc()
    plpy.error('%s: %s' % ( error, details ) )
$$;
相关阅读:
Top