Re: SQL Newbie Question - Mailing list pgsql-general

From btober@ct.metrocast.net
Subject Re: SQL Newbie Question
Date
Msg-id 45B8D2A4.9000601@ct.metrocast.net
Whole thread Raw
In response to Re: SQL Newbie Question  (Ron Johnson <ron.l.johnson@cox.net>)
Responses Re: SQL Newbie Question  (Ron Johnson <ron.l.johnson@cox.net>)
Re: SQL Newbie Question  (Inoqulath <inoqulath@aol.de>)
List pgsql-general
Ron Johnson wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On 01/25/07 09:30, Inoqulath wrote:
>
>> Hello Folks
>>
>> Have a look at this Table:
>>
>> CREATE TABLE foo(
>> id serial,
>> a_name text,
>> CONSTRAINT un_name UNIQUE (a_name));
>>
>> Obviously, inserting a string twice results in an error ...is there any "conflict algorithm" (SQLite:"INSERT OR
>> [IGNORE|ABORT] INTO foo [...]")?...
>>
> No.
>
>   Unique \U*nique"\, a. [F. unique; cf. It. unico; from L. unicus,
>      from unus one. See {One}.]
>      Being without a like or equal; ...
>

I think he is not asking "How do I insert duplicate rows into a
unique-constrained column?", but rather that he wants to have the insert
transaction proceed successfully, ignoring the duplicates, i.e., the
resulting inserted rows will number less than the original source rows
by exactly the subset of duplicate source rows.

My suggestion would be to load the data into an unconstrained temporary
table, then select distinct from that for insertion into your actual
working table.




pgsql-general by date:

Previous
From: Ron Johnson
Date:
Subject: Re: column limit
Next
From: Ron Johnson
Date:
Subject: Re: Problem with result ordering