Received: from news.tht.net (news.hub.org [216.126.91.242]) by postgresql.org (8.11.3/8.11.4) with ESMTP id fBSMuxm29853 for ; Fri, 28 Dec 2001 17:56:59 -0500 (EST) (envelope-from news@news.tht.net) Received: (from news@localhost) by news.tht.net (8.11.4/8.11.4) id fBSMfal67003 for pgsql-admin@postgresql.org; Fri, 28 Dec 2001 17:41:36 -0500 (EST) (envelope-from news) From: reina@nsi.edu (Tony Reina) X-Newsgroups: comp.databases.postgresql.admin Subject: Re: Primary Key Problems Date: 28 Dec 2001 14:41:34 -0800 Organization: http://groups.google.com/ Lines: 30 Message-ID: References: <20011208014433.GA2913@c0de.net> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Complaints-To: groups-abuse@google.com To: pgsql-admin@postgresql.org X-Archive-Number: 200112/161 X-Sequence-Number: 2884 pgsql@c0de.net (Phill Kenoyer) wrote in message news:<20011208014433.GA2913@c0de.net>... > 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. > I don't think primary keys per se are unique, but rather can be made unique by specifying that option. IIRC primary keys just allow you to index searches within the database. So to make a unique primary key from your db schema: CREATE TABLE "inventory" ( "stock" character varying(50) NOT NULL, "inventory_type" character varying(20) DEFAULT 'unknown' NOT NULL, "client_id" integer NOT NULL, [...] UNIQUE ("stock", "inventory_type", "client_id") Constraint "inventory_pkey" Primary Key ("stock", "inventory_type", "client_id") ); HTH, -Tony BTW, I'm using Google newsgroups to view the Postgres messages, but haven't seen posted messages in several days on the Hackers list. Does anyone know if this is a Google glitch or is the hackers list just not very active during the holiday?