From: | Sergey Grinko <sergey(dot)grinko(at)gmail(dot)com> |
---|---|
To: | pgadmin-support(at)postgresql(dot)org |
Subject: | pgScript Scripting Language - catch exception |
Date: | 2015-08-28 15:42:34 |
Message-ID: | CAA8WaEFjWTCPsgNBjyOW_btEhVkwEd6opBCqPTQK+vzyPYWXPw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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(dot)grinko(at)gmail(dot)com
From | Date | Subject | |
---|---|---|---|
Next Message | Gabriel E. Sánchez Martínez | 2015-08-28 15:52:53 | PgAdmin3, SSL certificate connections refused |
Previous Message | Nima Azizzadeh | 2015-08-28 14:29:25 | Define two factor authentication for Postgresql Server |