On Fri, Jan 18, 2019 at 5:45 PM Tom Lane <
tgl@sss.pgh.pa.us> wrote:
>
> This is not the default appearance of psql error reports.
> I'd venture that you are setting VERBOSITY=verbose in your
> environment, perhaps in ~/.psqlrc. If you want the same
> behavior on your Windows machine, you need to do that there too.
Unfortunately, it's not the problem of verbosity.
The error code is printed properly in case of duplicate key violation. It seems that something is wrong with idle-in-transaction timeout on Windows:
postgres=# \set VERBOSITY verbose
postgres=# SET idle_in_transaction_session_timeout=500;
SET
postgres=# BEGIN;
BEGIN
postgres=# SELECT * FROM pg_class;
server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
The connection to the server was lost. Attempting reset: Succeeded.
postgres=# CREATE TABLE demo (key BIGINT PRIMARY KEY);
CREATE TABLE
postgres=# INSERT INTO demo VALUES (1);
INSERT 0 1
postgres=# INSERT INTO demo VALUES (1);
ERROR: 23505: duplicate key value violates unique constraint "demo_pkey"
DETAIL: Key (key)=(1) already exists.
SCHEMA NAME: public
TABLE NAME: demo
CONSTRAINT NAME: demo_pkey
LOCATION: _bt_check_unique, nbtinsert.c:433
Best regards,
Marcin