| From: | "scott(dot)marlowe" <scott(dot)marlowe(at)ihs(dot)com> |
|---|---|
| To: | Gaetano Mendola <mendola(at)bigfoot(dot)com> |
| Cc: | <pgsql-general(at)postgresql(dot)org>, Mirek Rusin <anonymous(at)anonymous(dot)org> |
| Subject: | Re: insert duplicated unique/PK with no errors |
| Date: | 2003-09-25 14:15:15 |
| Message-ID: | Pine.LNX.4.33.0309250813150.17987-100000@css120.ihs.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
On Thu, 25 Sep 2003, Gaetano Mendola wrote:
> Mirek Rusin wrote:
>
> > ...what is the best way to force duplicated unique
> > or primary key'ed row inserts not to raise errors?
>
> Doesn't make sense, am I missing the point ?
I think what he may want is:
create table test (id serial primary key, info text unique);
begin;
insert into test values (DEFAULT,'abc');
INSERT 1
insert into test values (22,'def');
INSERT 1
insert into test values (22,'def');
INSERT 0
commit;
In order to do this, you'll need triggers that fire on the unique / pk
before insertion, and if the values would be dups, to simply drop the
insert silently.
Can that be done, by the way?
| From | Date | Subject | |
|---|---|---|---|
| Next Message | scott.marlowe | 2003-09-25 14:17:36 | Re: [GENERAL] PostgreSQL at OSCON 2004 |
| Previous Message | kpub | 2003-09-25 14:11:52 | Multilingual db |