No exception is generated when inserting a duplicate.

Sample:
CREATE DATABASE test;
CREATE TABLE test (
  id serial NOT NULL,
  label character varying(50),
  CONSTRAINT test_pkey PRIMARY KEY (id)
);

Then run the 3 commands as one PgScript:
*insert into test (id, label) values(1, '1');*
*insert into test (id, label) values(1, '2');* *-- We have here **exception:
ERROR: duplicate key value violates unique constraint "test_pkey"*
*insert into test (id, label) values(2, '2');*

What I see in the window "Output pane":




*[QUERY    ] insert into test (id, label) values(1, '1')[WARNING  ] insert
into test (id, label) values(1, '2')            [QUERY    ] insert into
test (id, label) values(2, '2')            *
Questions:
How do I know that an error occurred?
How to stop the continuation of the script?


-- 
Yours faithfully, Sergey Grinko
Email: sergey.gri...@gmail.com

Reply via email to