Re: PostgreSQL Developer Best Practices

From: Gavin Flower <GavinFlower(at)archidevsys(dot)co(dot)nz>
To: Melvin Davidson <melvin6925(at)gmail(dot)com>, Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
Cc: Rob Sargent <robjsargent(at)gmail(dot)com>, pgsql-general General <pgsql-general(at)postgresql(dot)org>
Subject: Re: PostgreSQL Developer Best Practices
Date: 2015-08-25 20:42:23
Message-ID: 55DCD32F.6070301@archidevsys.co.nz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 26/08/15 03:40, Melvin Davidson wrote:
[...]
> IOW: If we have an account table, then the account_id or account_no
> would be the primary key. There is no need to have a separate
> serial id as the primary key.
[...]

Account numbers are externally generated, and may potentially change.
Management might suddenly decide that they want to start using the year
the account started as the first 4 digits, or that the branch code
should be reflected in it, or something else. The database should be
protected from these arbitrary changes. Hence the account_no is not a
good candidate for a primary key.

Cheers,
Gavin

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2015-08-25 20:56:35 Re: PostgreSQL Developer Best Practices
Previous Message Joseph Kregloh 2015-08-25 20:36:33 Re: Why does splitting $PGDATA and xlog yield a performance benefit?