| From: | Zeugswetter Andreas SB <ZeugswetterA(at)wien(dot)spardat(dot)at> |
|---|---|
| To: | "'Mike Mascari'" <mascarm(at)mascari(dot)com>, pgsql-hackers(at)postgresql(dot)org |
| Subject: | AW: Possible feature? |
| Date: | 2001-07-11 12:25:08 |
| Message-ID: | 11C1E6749A55D411A9670001FA68796336837A@sdexcsrv1.f000.d0188.sd.spardat.at |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
> 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
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Martijn van Oosterhout | 2001-07-11 12:57:39 | Re: 2 gig file size limit |
| Previous Message | Jan Wieck | 2001-07-11 12:19:46 | Re: New SQL Datatype RECURRINGCHAR |