Thread: UNIQUE on everything except primary key

UNIQUE on everything except primary key

From
gvim
Date:
I have a table with 11 columns and want to eliminate duplication on INSERTs. What's the best method? The obvious
solutionwould be to create a UNIQUE index on everything except the primary key - 'id' - but that's a 10-column index
anddoesn't sound very efficient. Am I missing something more obvious?
 

gvim


Re: UNIQUE on everything except primary key

From
Andreas Gaab
Date:
Did you check check constraints?
http://www.postgresql.org/docs/8.4/static/ddl-constraints.html

Best
Andreas

-----Ursprüngliche Nachricht-----
Von: pgsql-sql-owner@postgresql.org [mailto:pgsql-sql-owner@postgresql.org] Im Auftrag von gvim
Gesendet: Donnerstag, 3. Februar 2011 16:44
An: pgsql sql
Betreff: [SQL] UNIQUE on everything except primary key

I have a table with 11 columns and want to eliminate duplication on INSERTs. What's the best method? The obvious
solutionwould be to create a UNIQUE index on everything except the primary key - 'id' - but that's a 10-column index
anddoesn't sound very efficient. Am I missing something more obvious? 

gvim

--
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql


Re: UNIQUE on everything except primary key

From
msi77
Date:
Do all the 10 columns make a natural key?

03.02.2011, 18:44, "gvim" <gvimrc@gmail.com>:
> I have a table with 11 columns and want to eliminate duplication on INSERTs. What's the best method? The obvious
solutionwould be to create a UNIQUE index on everything except the primary key - 'id' - but that's a 10-column index
anddoesn't sound very efficient. Am I missing something more obvious?
 
>
> gvim
>
> --
> Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-sql