> Then, when the UNIQUE constraint of the index is violated, instead of
> the message:
>
> 'Cannot insert a duplicate key into a unique index i_test1'
>
> the client application would receive:
>
> 'An employee with a matching Social Security number already exists'
I would only allow this text to be output in addition to the standard
text. Else confusion would imho be too great for the unwary admin.
Thus following would be returned:
ERROR 03005 'Cannot insert a duplicate key into a unique index i_test1'
DESCRIPTION 'An employee with a matching Social Security number already exists'
On the other hand, what hinders you from using a "speaking" name for the
constraint ?
postgres=# create table aa (id int, constraint "for Social Security number" unique (id));
NOTICE: CREATE TABLE/UNIQUE will create implicit index 'for Social Security number' for table 'aa'
CREATE
postgres=# insert into aa values (1);
INSERT 23741 1
postgres=# insert into aa values (1);
ERROR: Cannot insert a duplicate key into unique index for Social Security number
postgres=# :-O
Andreas