Received: from home.c0de.net (209.dsl6660135.nokia.surewest.net [66.60.135.209]) by postgresql.org (8.11.3/8.11.4) with ESMTP id fB81iTm20234 for ; Fri, 7 Dec 2001 20:44:34 -0500 (EST) (envelope-from phill@home.c0de.net) Received: from phill by home.c0de.net with local (Exim 3.33 #1 (Debian)) id 16CWXb-0000lE-00 for ; Fri, 07 Dec 2001 17:44:35 -0800 Date: Fri, 7 Dec 2001 17:44:34 -0800 From: Phill Kenoyer To: pgsql-admin@postgresql.org Subject: Primary Key Problems Message-ID: <20011208014433.GA2913@c0de.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.3.24i X-Archive-Number: 200112/55 X-Sequence-Number: 2779 Here is a good one. I have three fields set for my primary key. Now I thought that a primary key was unique, and dups can not be inserted. CREATE TABLE "inventory" ( "stock" character varying(50) NOT NULL, "inventory_type" character varying(20) DEFAULT 'unknown' NOT NULL, "client_id" integer NOT NULL, [...] Constraint "inventory_pkey" Primary Key ("stock", "inventory_type", "client_id") ); and I insert into the db and get dups. client_id | stock | inventory_type -----------+-------+---------------- 81 | 2001 | new 81 | 2001 | new 81 | 2003 | new 81 | 2005 | new 81 | 2006 | new 81 | 2006 | new 81 | 2008 | new 81 | 2008 | new Why did I get dups in my data? PostgreSQL 7.1.3 on i686-pc-linux-gnu, compiled by GCC 2.95.4 Thanks. -- Reason: Flat tire on station wagon with tapes. ("Never underestimate the bandwidth of a station wagon full of tapes hurling down the highway" Andrew S. Tanenbaum) _ | _ (_()(|('.|)('||.|()|`|(