小编San*_*ani的帖子

如何报告Postgres/plpgsql中发生错误的行?

我一直在postgres中使用或多或少这样的东西来模拟如何在SQL Server中使用Try/Catch块,如果发现错误,可以在Catch中回滚事务:

do $$
begin
[SQL here]

exception when others then
    raise notice 'Error in insert statement ---> % %', SQLERRM, SQLSTATE LINE;
end;    

$$ language 'plpgsql';
Run Code Online (Sandbox Code Playgroud)

有没有办法报告发生错误的行,如"ERROR_LINE()?

提前致谢

postgresql error-handling plpgsql

5
推荐指数
1
解决办法
3646
查看次数

标签 统计

error-handling ×1

plpgsql ×1

postgresql ×1