
> 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

Wed, 11 Jul 2001 14:25:08 +0200
Zeugswetter Andreas SB  <ZeugswetterA@wien.spardat.at>
AW: Possible feature?
Zeugswetter Andreas SB wrote:
> 
> 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

I might want the message to be in some other language ...

I might even want the language to depend on CURRENT_USER.

-------------
Hannu

Wed, 11 Jul 2001 14:58:59 +0200
Hannu Krosing <hannu@tm.ee>
Re: AW: Possible feature?