Search Postgresql Archives

Re: SQL Newbie Question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.





[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux