X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 72108D1C98E for ; Tue, 10 Feb 2004 20:13:43 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 73004-02 for ; Tue, 10 Feb 2004 16:13:37 -0400 (AST) Received: from wolff.to (wolff.to [66.93.249.74]) by svr1.postgresql.org (Postfix) with SMTP id 90A85D1B911 for ; Tue, 10 Feb 2004 16:13:35 -0400 (AST) Received: (qmail 25465 invoked by uid 500); 10 Feb 2004 20:15:21 -0000 Date: Tue, 10 Feb 2004 14:15:21 -0600 From: Bruno Wolff III To: mohan@physics.gmu.edu Cc: pgsql-sql@postgresql.org, torque-user@db.apache.org Subject: Re: Unique Constraint with foreign Key Message-ID: <20040210201521.GA13737@wolff.to> Mail-Followup-To: mohan@physics.gmu.edu, pgsql-sql@postgresql.org, torque-user@db.apache.org References: <64366.138.88.163.115.1076432616.squirrel@physics.gmu.edu> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <64366.138.88.163.115.1076432616.squirrel@physics.gmu.edu> User-Agent: Mutt/1.5.4i X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200402/100 X-Sequence-Number: 16791 On Tue, Feb 10, 2004 at 12:03:36 -0500, mohan@physics.gmu.edu wrote: > Hi all i am using postgres and torque > I have a column x in Table A of type varchar and NOT NULL. I want to > impose a unique key constraint on that table and column y is the primary > key. > I have another Table B with column x. can i make this column x as a > foreign key on column x in table A. Yes. The reference will need to specify column x, since the primary key column (y) will be the default. > or Can i have varchar types of size 50 as primary keys in Postgres. Yes. But unless the 50 character limit comes from a business rule, you might want to use the type 'text'.