pgScript Scripting Language - catch exception - Mailing list pgadmin-support

From Sergey Grinko
Subject pgScript Scripting Language - catch exception
Date
Msg-id CAA8WaEFjWTCPsgNBjyOW_btEhVkwEd6opBCqPTQK+vzyPYWXPw@mail.gmail.com
Whole thread Raw
List pgadmin-support
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.grinko@gmail.com

pgadmin-support by date:

Previous
From: Nima Azizzadeh
Date:
Subject: Define two factor authentication for Postgresql Server
Next
From: Gabriel E. Sánchez Martínez
Date:
Subject: PgAdmin3, SSL certificate connections refused