如何在传递给应用程序的数据中包含 PostgreSQL 错误 where 子句



目前,当出现错误时,PostgreSQL 只会向我的应用程序返回错误消息,例如:

[42601] ERROR: INSERT has more expressions than target columns 

但是,如果我在像 DataGrip 这样的 SQL 工具中运行相同的查询,我会看到一个额外的 where 消息,告诉我问题实际发生的位置,例如,

[42601] ERROR: INSERT has more expressions than target columns 
Where: PL/pgSQL function trigger_assort_md() line 17 at SQL statement

如何让 PostgreSQL 除了返回错误消息之外的 where 消息?我想我需要在postgresql.conf中进行更改,我只是不知道要进行什么更改。

可能你可以使用这个:https://www.postgresql.org/docs/9.4/static/plpgsql-control-structures.html#PLPGSQL-EXCEPTION-DIAGNOSTICS-VALUES +

最新更新