pgScript Scripting Language - catch exception

Поиск
Список
Период
Сортировка
От Sergey Grinko
Тема pgScript Scripting Language - catch exception
Дата
Msg-id CAA8WaEFjWTCPsgNBjyOW_btEhVkwEd6opBCqPTQK+vzyPYWXPw@mail.gmail.com
обсуждение исходный текст
Список 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 по дате отправления:

Предыдущее
От: Nima Azizzadeh
Дата:
Сообщение: Define two factor authentication for Postgresql Server
Следующее
От: Gabriel E. Sánchez Martínez
Дата:
Сообщение: PgAdmin3, SSL certificate connections refused