pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Phill Kenoyer <pgsql@c0de.net>
To: pgsql-admin@postgresql.org
Subject: Primary Key Problems
Date: Fri, 7 Dec 2001 17:44:34 -0800
Message-ID: <20011208014433.GA2913@c0de.net> (raw)

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)
                                               _   |       _           
                                              (_()(|('.|)('||.|()|`|(



view thread (8+ messages)  latest in thread

Message-ID: <20011208014433.GA2913@c0de.net>
Permalink:  ../20011208014433.GA2913@c0de.net/
Also on:    postgresql.org/message-id/20011208014433.GA2913@c0de.net

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: pgsql@c0de.net
  Subject: Re: Primary Key Problems
  In-Reply-To: <20011208014433.GA2913@c0de.net>
  References: <20011208014433.GA2913@c0de.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox