Re: UNIQUE on everything except primary key

From: Andreas Gaab <A(dot)Gaab(at)scanlab(dot)de>
To: 'gvim' <gvimrc(at)gmail(dot)com>
Cc: pgsql sql <pgsql-sql(at)postgresql(dot)org>
Subject: Re: UNIQUE on everything except primary key
Date: 2011-02-03 15:48:23
Message-ID: 48DA836F3865C54B8FBF424A3B775AF6671A683922@Exchange-Server
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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(at)postgresql(dot)org [mailto:pgsql-sql-owner(at)postgresql(dot)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 solution would be to create a UNIQUE index on everything except the primary key - 'id' - but that's a 10-column index and doesn't sound very efficient. Am I missing something more obvious?

gvim

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2011-02-03 16:31:46 Re: Transaction-specific global variable
Previous Message gvim 2011-02-03 15:44:23 UNIQUE on everything except primary key