From torque-user-return-4148-apmail-db-torque-user-archive=db.apache.org@db.apache.org Tue Feb 10 20:17:25 2004 Return-Path: Delivered-To: apmail-db-torque-user-archive@www.apache.org Received: (qmail 1605 invoked from network); 10 Feb 2004 20:17:25 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 10 Feb 2004 20:17:25 -0000 Received: (qmail 50924 invoked by uid 500); 10 Feb 2004 20:17:08 -0000 Delivered-To: apmail-db-torque-user-archive@db.apache.org Received: (qmail 50911 invoked by uid 500); 10 Feb 2004 20:17:08 -0000 Mailing-List: contact torque-user-help@db.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Apache Torque Users List" Reply-To: "Apache Torque Users List" Delivered-To: mailing list torque-user@db.apache.org Received: (qmail 35241 invoked from network); 10 Feb 2004 20:13:31 -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: [SQL] 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-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N 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'. --------------------------------------------------------------------- To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org For additional commands, e-mail: torque-user-help@db.apache.org