Re: Strategy for Primary Key Generation When Populating Table

From: Merlin Moncure <mmoncure(at)gmail(dot)com>
To: Rich Shepard <rshepard(at)appl-ecosys(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Strategy for Primary Key Generation When Populating Table
Date: 2012-02-09 17:01:58
Message-ID: CAHyXU0yoW5CsCD4wY+9WKoDiQiVksEZFtPWgNpTTuerQ4tB4ow@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, Feb 9, 2012 at 10:49 AM, Rich Shepard <rshepard(at)appl-ecosys(dot)com> wrote:
>  I have a lot of data currently in .pdf files. I can extract the relevant
> data to plain text and format it to create a large text file of "INSERT INTO
> ..." rows. I need a unique ID for each row and there are no columns that
> would make a natural key so the serial data type would be appropriate.

The record should be logically unique as well as physically unique (of
if it isn't, why bother making a unique constraint at all?).
Sometimes you *have* to force a surrogate, for example if certain
(broken) client tools need a primary key to work, but aside from that
you shouldn't rely on a surrogate to generate uniqueness.

merlin

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Rich Shepard 2012-02-09 17:08:57 Re: Strategy for Primary Key Generation When Populating Table
Previous Message Rich Shepard 2012-02-09 16:49:17 Strategy for Primary Key Generation When Populating Table