From: | Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> |
---|---|
To: | PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | patch for 9.2: enhanced errors |
Date: | 2011-06-08 20:14:42 |
Message-ID: | BANLkTimRV2BWdO=iFt-mwu8an113kKmk1g@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hello
Attached patch implements a new erros's fields that describes table,
colums related to error. This enhanced info is limited to constraints
and RI.
example:
postgres=# create table omega(a int unique not null check (a > 10));
NOTICE: 00000: CREATE TABLE / UNIQUE will create implicit index
"omega_a_key" for table "omega"
LOCATION: DefineIndex, indexcmds.c:389
CREATE TABLE
Time: 106.867 ms
postgres=# \set VERBOSITY verbose
postgres=# insert into omega values(0);
ERROR: 23514: new row for relation "omega" violates check constraint
"omega_a_check"
LOCATION: ExecConstraints, execMain.c:1547
CONSTRAINT: omega_a_check
SCHEMA: public
TABLE: omega
COLUMNS: a
postgres=# insert into omega values(null);
ERROR: 23502: null value in column "a" violates not-null constraint
LOCATION: ExecConstraints, execMain.c:1519
CONSTRAINT: not_null_constraint
SCHEMA: public
TABLE: omega
COLUMNS: a
postgres=# insert into omega values(20);
INSERT 0 1
Time: 60.588 ms
postgres=# insert into omega values(20);
ERROR: 23505: duplicate key value violates unique constraint "omega_a_key"
DETAIL: Key (a)=(20) already exists.
LOCATION: _bt_check_unique, nbtinsert.c:432
CONSTRAINT: omega_a_key
SCHEMA: public
TABLE: omega
COLUMNS: a
postgres=#
This is base for support variables CONSTRAINT_NAME, SCHEMA_NAME and
TABLE_NAME for GET DIAGNOSTICS statement.
All regress tests was successfully passed
Regards
Pavel Stehule
Attachment | Content-Type | Size |
---|---|---|
enhanced-errors.diff | text/x-patch | 21.9 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Alex Hunsaker | 2011-06-08 20:14:43 | Re: gcc 4.6 and hot standby |
Previous Message | Kevin Grittner | 2011-06-08 19:40:40 | Re: could not truncate directory "pg_serial": apparent wraparound |