X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 2E4FD56440 for ; Wed, 2 Mar 2005 16:16:01 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 11857-03 for ; Wed, 2 Mar 2005 16:15:56 +0000 (GMT) Received: from MM01SNLNTO.son.sandia.gov (mm01snlnto.sandia.gov [132.175.109.20]) by svr1.postgresql.org (Postfix) with ESMTP id D849D5643F for ; Wed, 2 Mar 2005 16:15:54 +0000 (GMT) Received: from 132.175.109.4 by MM01SNLNTO.son.sandia.gov with ESMTP ( Tumbleweed MMS SMTP Relay 01 (MMS v5.6.3)); Wed, 02 Mar 2005 09:15:43 -0700 X-Server-Uuid: 2C1074A8-2B28-4DE3-9F7D-FF40AE090BA2 Received: from ES22SNLNT.srn.sandia.gov (ec03snlnt.sandia.gov [134.253.164.158] (may be forged)) by mailgate2.sandia.gov ( 8.12.11/8.12.11) with ESMTP id j22GF9B2020771; Wed, 2 Mar 2005 09:15:41 -0700 (MST) Received: from 134.252.13.164 ([134.252.13.164]) by ES22SNLNT.srn.sandia.gov ([134.253.164.160]) with Microsoft Exchange Server HTTP-DAV ; Wed, 2 Mar 2005 16:15:39 +0000 Received: from boomerang by ES22SNLNT.srn.sandia.gov; 02 Mar 2005 08:14: 12 -0800 Subject: Re: table constraints From: "Casey T. Deccio" To: "Greg Patnude" Cc: pgsql-sql@postgresql.org In-Reply-To: References: <1109618910.32166.0.camel@boomerang.ran.sandia.gov> Organization: Sandia National Laboratories Date: Wed, 02 Mar 2005 08:14:12 -0800 Message-ID: <1109780052.11469.4.camel@boomerang.ran.sandia.gov> MIME-Version: 1.0 X-Mailer: Evolution 2.0.3 X-PMX-Version: 4.7.0.111621, Antispam-Engine: 2.0.1.0, Antispam-Data: 2005.3.2.7 X-WSS-ID: 6E3B392418W1464552-01-01 Content-Type: text/plain Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=1.372 tagged_above=0 required=5 tests=AWL, RCVD_NUMERIC_HELO X-Spam-Level: * X-Archive-Number: 200503/22 X-Sequence-Number: 20501 On Tue, 2005-03-01 at 09:56 -0700, Greg Patnude wrote: > foreign keys and primary keys have to be defined as unique at the > table / > column level if you want to implement a check constraint -- your > contrived > example doesn't stand up all that well -- If you want to use > constraints -- > then your database schema should conform to traditional RDBMS theory > and > data normalization by having primary and foreign keys instead of just > trying to create arbitrary contraints on a non-normalized schema and > implement constraints as a user-defined function... > You are correct. I did not take the time to write in these constraints in the contrived example because I was rapidly trying to put together something that would simply illustrate the problem. They were/are in place in my actual schema. Thanks, Casey