Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id BF6CB47637B for ; Wed, 28 Aug 2002 02:12:16 -0400 (EDT) Received: from atlexchange.secureworks.net (mail.secureworks.net [209.101.212.155]) by postgresql.org (Postfix) with ESMTP id D540A476378 for ; Wed, 28 Aug 2002 02:12:15 -0400 (EDT) Received: from nemain (gabrielle.internal.secureworks.net [192.168.14.102]) by atlexchange.secureworks.net with SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2653.13) id R3J7W8NA; Wed, 28 Aug 2002 02:12:28 -0400 Content-Type: text/plain; charset="us-ascii" From: Casey Allen Shobe Organization: SecureWorks, Inc. To: pgsql-admin@postgresql.org Subject: Multiple keys? Date: Wed, 28 Aug 2002 02:10:44 -0400 User-Agent: KMail/1.4.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-Id: <200208280210.44746.cshobe@secureworks.net> X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200208/315 X-Sequence-Number: 5429 In order to get the foreign key I want working, I had to have two unique=20 references on the parent table, though the second covers two columns that a= re=20 contained within the first. Is this wise? Is there a better way? create table "package_info" ( "info_id" integer not null unique default nextval('package_info_info_id_seq') primary key, "package_id" integer not null references "packages" ("package_id"), "package_version" varchar(16) not null default '0.0.1', "info_type" varchar(32) not null default 'extra_data', "info_value" text not null default 'Default', unique ("package_id", "package_version", "info_type"), unique ("package_id", "package_version") ); create table "box_packages" ( "install_id" integer not null unique default nextval('box_packages_install_id_seq') primary key, "box_id" integer not null references "boxes" ("box_id"), "package_id" integer not null, "package_version" varchar(16) not null, "install_date" timestamp with time zone not null, "uninstall_data" timestamp with time zone, foreign key ("package_id", "package_version") references "package_info" ("package_id", "package_version"), unique ("box_id", "package_id", "package_version", "install_date") ); Danke, --=20 Casey Allen Shobe / Network Security Analyst & PHP Developer SecureWorks, Inc. / 404.327.6339 x169 / Fax: 404.728.0144 cshobe@secureworks.net / http://www.secureworks.net Content is my own and does not necessarily represent my company.