pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Aaron Bono <postgresql@aranya.com>
To: David Clarke <pigwin32@gmail.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: Alternative to serial primary key
Date: Thu, 6 Jul 2006 11:02:37 -0500
Message-ID: <bf05e51c0607060902vdd8d993u470c128abf127d3d@mail.gmail.com> (raw)
In-Reply-To: <12b7ac1e0607060316ub7b5e21i5e8e3bef2504e02c@mail.gmail.com>
References: <12b7ac1e0607060316ub7b5e21i5e8e3bef2504e02c@mail.gmail.com>

On 7/6/06, David Clarke <pigwin32@gmail.com> wrote:
>
> I posted a couple of weeks back a question regarding the use of a 100
> char column as a primary key and the responses uniformily advised the
> use of a serial column. My concern is that the key is effectively
> abstract and I want to use the column as a foreign key in other
> tables.


I have a simple question... why do you want to use the column as a foreign
key in other tables?  If you use the serial column then all you need is a
simple join to get the 100 char column out in your query.  If you need to
make things simpler, just create a view that does the join for you.

Either there is some requirement here that I am not aware of or it sounds
like you may be trying to use a sledge hammer on a nail.

-Aaron

view thread (34+ messages)  latest in thread

Message-ID: <bf05e51c0607060902vdd8d993u470c128abf127d3d@mail.gmail.com>
Permalink:  ../bf05e51c0607060902vdd8d993u470c128abf127d3d@mail.gmail.com/
Also on:    postgresql.org/message-id/bf05e51c0607060902vdd8d993u470c128abf127d3d@mail.gmail.com

 · 

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: postgresql@aranya.com, pigwin32@gmail.com
  Subject: Re: Alternative to serial primary key
  In-Reply-To: <bf05e51c0607060902vdd8d993u470c128abf127d3d@mail.gmail.com>

* 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