From: | Phill Kenoyer <pgsql(at)c0de(dot)net> |
---|---|
To: | pgsql-admin(at)postgresql(dot)org |
Subject: | Primary Key Problems |
Date: | 2001-12-08 01:44:34 |
Message-ID: | 20011208014433.GA2913@c0de.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-admin |
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)
_ | _
(_()(|('.|)('||.|()|`|(
From | Date | Subject | |
---|---|---|---|
Next Message | Ian Barwick | 2001-12-08 01:52:55 | Re: Primary Key Problems |
Previous Message | Boban Acimovic | 2001-12-07 23:22:01 | How to get database schema without pg_dump? |