是否有可能获得我试图在 PSQL 或 MyBatis 中复制的行的另一个字段?

Is it possible to get another field of row I'm trying to duplicate in PSQL or MyBatis?

我有一个 table 'client',它有 3 列 - id、siebel_id、phone_number。 PhoneNumber 具有唯一约束。如果我用现有号码保存新客户,我会收到错误 ERROR: duplicate key value violates unique constraint "phone_number_unique"。 是否可以使 PSQL 或 MyBatis 显示 'siebel_id' 的记录,其中 phone 号码已保存? 我想收到类似

的消息
'ERROR: duplicate key value violates unique constraint "phone_number_unique"
  Detail: Key (phone_number)=(+79991234567) already exists on siebel_id...'

不,无法调整 PostgreSQL 数据库引擎 returns 伴随错误的内部消息。好吧......除非你从头开始重新编译整个 PostgreSQL 数据库,我会假设这是关闭 table.

但是,您可以使用 SQL 轻松搜索有问题的行,如:

select siebel_id from client where phone_number = '+79991234567';