簡體   English   中英

如何使PL / Python跟蹤更詳細?

[英]How to make PL/Python tracebacks more verbose?

當前在發生錯誤的情況下,我在PL / Python過程的psql有這樣的回溯,它會導入Python模塊並從中調用一些函數:

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"

我試圖在postgresql.conf設置log_error_verbosity = verbose並設置此環境變量PYTHONVERBOSE=1 PYTHONDEBUG=1 沒有任何幫助。

誰知道,如何在可能的情況下將其設置為更詳細?

我知道這已經很老了,但是我發現這很好。

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 ) )
$$;

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM