我在postgres 9.1中编写了一个强大的功能,并且处于调试阶段。这是我到目前为止的内容:
EXCEPTION WHEN others THEN
_ERRORMESSAGE = 'Error = ' || SQLERRM || SQLSTATE; --datagrip doesn't know what these are, but that's ok
--TODO: upon the upgrade to or past 9.2 get the error line number https://stackoverflow.com/questions/30631735/how-does-one-report-the-line-on-which-an-error-occured-in-postgres-plpgsql
INSERT INTO hr.tbl_diagnostics_punch_proclog
(procexeid
,create_datetime
,employeeid
,sqltext)
VALUES
( _PROCEXEID
, current_timestamp
, _EmployeeId
, _ERRORMESSAGE
);
我将运行该函数并从调试表中拉出,但不知道在哪里查找给定的错误。我可能会缺少一个变量吗?像SQLERRLINE
之类的东西?