pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Bruno Wolff III <bruno@wolff.to>
To: mohan@physics.gmu.edu
Cc: pgsql-sql@postgresql.org
Cc: torque-user@db.apache.org
Subject: Re: Unique Constraint with foreign Key
Date: Tue, 10 Feb 2004 14:15:21 -0600
Message-ID: <20040210201521.GA13737@wolff.to> (raw)
In-Reply-To: <64366.138.88.163.115.1076432616.squirrel@physics.gmu.edu>
References: <64366.138.88.163.115.1076432616.squirrel@physics.gmu.edu>

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'.



view thread (6+ messages)  latest in thread

Message-ID: <20040210201521.GA13737@wolff.to>
Permalink:  ../20040210201521.GA13737@wolff.to/
Also on:    postgresql.org/message-id/20040210201521.GA13737@wolff.to

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: bruno@wolff.to, mohan@physics.gmu.edu, torque-user@db.apache.org
  Subject: Re: Unique Constraint with foreign Key
  In-Reply-To: <20040210201521.GA13737@wolff.to>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox